This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Jiri.Horky
Recipients Jiri.Horky, bero, eric.araujo, ezio.melotti, orsenthil, santoso.wijaya, terry.reedy
Date 2011-05-15.18:29:59
SpamBayes Score 2.572897e-05
Marked as misclassified No
Message-id <1305484200.4.0.764261304288.issue11898@psf.upfronthosting.co.za>
In-reply-to
Content
I have the same problem as the original submitter.

The reason it previously worked for you was probably because you didn't utilize a "right" unicode string in the urllib2.request. The following code will raise the exception (I enclose the data file for completeness, but it fails with basically any binary data).

It works fine with Python 2.6.6, but fails with Python 2.7.1.

{{{
import urllib2

f = open("data", "r")
mydata = f.read()
f.close()

#this fails
url=unicode('http://localhost/test')

#this works
#url=str('http://localhost/test')

#this also works 
#url=unicode('http://localhost')

req = urllib2.Request(url, data=mydata)
urllib2.urlopen(req)
}}}
History
Date User Action Args
2011-05-15 18:30:00Jiri.Horkysetrecipients: + Jiri.Horky, terry.reedy, orsenthil, bero, ezio.melotti, eric.araujo, santoso.wijaya
2011-05-15 18:30:00Jiri.Horkysetmessageid: <1305484200.4.0.764261304288.issue11898@psf.upfronthosting.co.za>
2011-05-15 18:29:59Jiri.Horkylinkissue11898 messages
2011-05-15 18:29:59Jiri.Horkycreate