How to handle relative paths doesn't work for video_upload method but work in photo_upload using instagrapi on Python? #1507
Unanswered
geraldabrhm
asked this question in
Q&A
Replies: 1 comment
-
Look carefully at your traceback and where the FileNotFoundError exception appears, print the resulting path and check that the file exists on this path. This is definitely not an instagrapi problem, you just made a mistake somewhere and you should do what I suggested above |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I use Python 3.11 and instagrapi package to upload photos and videos.
Here are the snippets of the method that I create to do the content upload (
instagram.py
):And here are my directory structure:
When I run the script with
request['media_type']
value isphoto
, it works properly (the photo being posted and the methods return{"success": True, ...}
).But when I do it with
request['media_type']
value isvideo
, it jumps to the catch exception and returns the errorFileNotFoundError(2, 'No such file or directory')"
.I even try to input the absolute path as the
Path
params inclient.video_upload()
method but it doesn't work either. How to fix this problem and input the proper file path in theclient.video_upload()
?Notes:
I have to make sure that the file format is correct as mentioned in the documentation.
I have also tried using an absolute path but it doesn't work either. I have also tried to use the
Path
type rather than the string one by doing this:Beta Was this translation helpful? Give feedback.
All reactions