Error when uploading video - "AttributeError: 'NoneType' object has no attribute 'extension'"
See original GitHub issueI cloned the repo and tried to run the example “upload-a-video.py”:
from instapy_cli import client
username = 'xxxxx'
password = 'xxxxx'
video = '../docs/video-sample-upload.mp4'
text = 'This will be the caption of your video.' + '\r\n' + 'You can also use hashtags! #hash #tag #now'
with client(username, password) as cli:
cli.upload(video, text)
But I got an error in the console that said:
Reusing settings: ig.json
Traceback (most recent call last):
File "upload-a-video.py", line 9, in <module>
cli.upload(video, text)
File "/Library/Python/2.7/site-packages/instapy_cli/cli.py", line 105, in upload
media = Media(file)
File "/Library/Python/2.7/site-packages/instapy_cli/media.py", line 29, in __init__
self.check_type()
File "/Library/Python/2.7/site-packages/instapy_cli/media.py", line 32, in check_type
self.media_ext = filetype.guess(self.media_path).extension
AttributeError: 'NoneType' object has no attribute 'extension'
Any idea what I’m doing wrong?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:10 (2 by maintainers)
Top Results From Across the Web
"AttributeError: 'NoneType' object has no attribute 'extension ...
I cloned the repo and tried to run the example "upload-a-video.py": from instapy_cli import client username = 'xxxxx' password = 'xxxxx' video =...
Read more >Instagram with instapy_cli: how to fix an error
Error when uploading video – “AttributeError: 'NoneType' object has no attribute 'extension'”. so I searched in the issues forum of ...
Read more >Why do I get AttributeError: 'NoneType' object has no attribute ...
NoneType means that instead of an instance of whatever Class or Object you think you're working with, you've actually got None .
Read more >[FIXED] AttributeError: 'NoneType' object has no attribute ...
Hence, AttributeError: 'NoneType' object has no attribute 'something' error occurs when the type of object you are referencing is None.
Read more >AttributeError: 'NoneType' object has no attribute 'copy'
It sounds like cv2.imread() is expecting uploaded_file to be a string (the name of a file), but it's actually an object. It doesn't...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@b3nab i have the solution, the issue’s origin is actually the filetype library and specifically this line at media.py
self.media_ext = filetype.guess(self.media_path).extension
filetype is returning None on some videos so to fix it you can use Magic instead of filetype PyPi: https://pypi.org/project/python-magic-bin/0.4.14/ or Pip: pip install python-magic-bin so now in the media.py first :import magic
then change the check_type function to this: `def check_type(self):
Hey guys I have been having the same issue my code was:
from
instapy_cli import clientusername = ‘testing211714’ password = ‘****’ image = ‘posts/keenan.png’ text = ‘This will be the caption of your photo.’ + ‘\r\n’ + ‘You can also use hashtags! #hash #tag #now’
with client(username, password) as cli: cli.upload(image, text)`
But recieved the error: (env) Ryans-MacBook-Pro:InstaAutomaterFirstTry ryankeenan$ python app.py [IG] not found cookie/cookie_file >> login as default Error parsing error response: Expecting value: line 1 column 1 (char 0) Error is >> Bad Request
Something went bad. Please retry or send an issue on https://github.com/b3nab/instapy-cli
Traceback (most recent call last): File “app.py”, line 9, in <module> cli.upload(image, text) File “/Users/ryankeenan/Desktop/git/InstaAutomaterFirstTry/env/lib/python3.7/site-packages/instapy_cli/cli.py”, line 153, in upload raise IOError(“Unable to upload.”) OSError: Unable to upload.
I followed @salahar9 advice and imported magic at media.py but the error just changed to: (env) Ryans-MacBook-Pro:InstaAutomaterFirstTry ryankeenan$ python app.py [IG] not found cookie/cookie_file >> login as default Error parsing error response: Expecting value: line 1 column 1 (char 0) Error is >> Bad Request
Something went bad. Please retry or send an issue on https://github.com/b3nab/instapy-cli
Traceback (most recent call last): File “app.py”, line 10, in <module> cli.upload(image, text) File “/Users/ryankeenan/Desktop/git/InstaAutomaterFirstTry/env/lib/python3.7/site-packages/instapy_cli/cli.py”, line 153, in upload raise IOError(“Unable to upload.”) OSError: Unable to upload. Does anyone see where I went wrong??