IOError 35 when trying to read the result of call to urllib2.urlopen

matt matthew.a.hess at gmail.com
Sat Sep 10 02:19:38 CEST 2011


I'm using urllib2's urlopen function to post to a service which should
return a rather lengthy JSON object as the body of its response.
Here's the code:

{{{
ctype, body = encode_multipart(fields, files)
url = 'http://someservice:8080/path/to/resource'
headers = {'Content-Type': ctype, 'Content-Length': str(len(body))}
req = urllib2.Request(url, body, headers)
resp = urllib2.urlopen(req)

resp_body = resp.read()
}}}

When I try to look at "resp_body" I get this error:

IOError: [Errno 35] Resource temporarily unavailable

I posted to the same URI using curl and it worked fine, so I don't
think it has to do with the server.

Any thoughts?



More information about the Python-list mailing list