Open GoogleCodeExporter opened 9 years ago
The sample code uses a chunksize of -1 (all at once):
https://code.google.com/p/youtube-api-samples/source/browse/samples/python/uploa
d_video.py#104
media_body=MediaFileUpload(options.file, chunksize=-1, resumable=True)
so it never chunks, thus it never runs the chunking code, which is where this
bug lives.
Original comment by cfkars...@gmail.com
on 6 May 2014 at 9:47
I'm sad too
Any fix for that?
Thanks,
Original comment by tht2401
on 29 Oct 2014 at 2:13
Nope.
The same code (and bug) is also here:
https://github.com/youtube/api-samples/blob/master/python/upload_video.py#L131-L
135
I stared to work on a fix, but testing error handling is hard, so I just gave
up and set chunksize=-1.
https://github.com/CarlFK/veyepar/blob/master/dj/scripts/youtube_v3_uploader.py#
L181
Original comment by cfkars...@gmail.com
on 29 Oct 2014 at 3:15
I added a simple line of code, it worked beautifully (check None for response):
.....
status, response = insert_request.next_chunk()
if response is not None:
if 'id' in response:
...
Original comment by tht2401
on 29 Oct 2014 at 4:20
I think you moved the bug to this:
if error is not None:
print error
retry += 1
if retry > MAX_RETRIES:
exit("No longer attempting to retry.")
You don't set error, so it is still None, so retry will never get incremented,
so it may loop forever.
Which may be better than erroring, but still not right.
I was hoping that by now someone would have fixed the code but I guess it isn't
a priority.
Original comment by cfkars...@gmail.com
on 29 Oct 2014 at 4:29
I haven't looked at api code but I think that response will be None until the
last chunk is sent.
error is not None only when we have an exception from
insert_request.next_chunk()
The sample code has MAX_RETRIES so it won't loop forever.
Original comment by tht2401
on 29 Oct 2014 at 4:39
ah right, I see what you are saying.
pretty please submit a pull request over on
https://github.com/youtube/api-samples (you can do it by editing the code right
there, click the edit link that takes you to
https://github.com/youtube/api-samples/edit/master/python/upload_video.py
Original comment by cfkars...@gmail.com
on 29 Oct 2014 at 4:46
https://github.com/youtube/api-samples/pull/18
Original comment by tht2401
on 29 Oct 2014 at 4:58
Original issue reported on code.google.com by
cfkars...@gmail.com
on 6 May 2014 at 7:02