Closed GoogleCodeExporter closed 9 years ago
I have no idea why is this. In my Python 2.7.5 I don't see that line in
httplib.py, it seems they have refactored it. If you know some python you can
try to debug it to see what values contains?
Original comment by tokland
on 6 Jun 2014 at 1:50
Ok, so this is the function:
def putheader(self, header, *values):
if self.__state != _CS_REQ_STARTED:
raise CannotSendHeader()
str = '%s: %s' % (header, '\r\n\t'.join(values))
self._output(str)
I then printed out the "values":
('identity',)
('www.google.com',)
('140',)
('application/x-www-form-urlencoded',)
Install pycurl to upload the video using HTTP
Start upload using basic gdata API: test.mp4
('gdata.youtube.com',)
('Python-urllib/1.17',)
('identity',)
('uploads.gdata.youtube.com',)
(1,)
So yeah, the last entry is in fact an INT. So I added the following for a
quick'n'dirty fix:
values = tuple(str(v) for v in values)
This seems to work as it starts to upload. But... it never seems to finish.
I'll try it a view more times; could be my internet (Fr. afternoon).
So, as I don't really wanna keep my code in the original Python code itself^^:
is there anything you/I can add in your script?
Thanks!
Original comment by ytdl...@gmail.com
on 6 Jun 2014 at 6:24
This integer in "(1,)" is causing the problem. Total hack, try:
str = '%s: %s' % (header, '\r\n\t'.join(map(str, values)))
Original comment by tokland
on 6 Jun 2014 at 6:34
This alone doesn't work, because "they" are using the function name for the
variable "str":
UnboundLocalError: local variable 'str' referenced before assignment
But if I change it to this, it works:
str1 = '%s: %s' % (header, '\r\n\t'.join(map(str, values)))
self._output(str1)
Thanks, I can now upload again!
I have to say, great support and fast response time :-)
Original comment by ytdl...@gmail.com
on 6 Jun 2014 at 6:49
Oh, overshadowing a builtin with a variable name in a core module, naughty
python devs :)
Glad it worked! this should help people having the same problems.
Original comment by tokland
on 6 Jun 2014 at 7:22
Original issue reported on code.google.com by
ytdlder-...@pages.plusgoogle.com
on 5 Jun 2014 at 3:02