On 04/20/2012 06:47 PM, Diego Manenti Martins wrote: > Hi. > Anybody knows the data is sent in a different way for Python 2.5, 2.6 > and 2.7 using this code: > >>>> import urllib2 >>>> url = 'http://server.com/post_image?tid=zoV6LJ' >>>> f = open('test.jpg') >>>> data = f.read() >>>> res = urllib2.urlopen(url, data) > It works the same way for python2.5 and python2.6 but not for python2.7 > > I checked the sent data with WireShark and it sends the data in a > different way. I'm not an expert I just see it's different :) > It might be a server problem although I think the lib should behave > equals for all versions. > > Thoughts? > Thank you all! I'd be surprised it works at all. A jpeg is binary, so you should be using the following form:
f = open('test.jpg', 'rb') -- DaveA -- http://mail.python.org/mailman/listinfo/python-list