J
Jamie
Hi all,
I have a Python 2.3.2 application that uses the httplib package to download
files. On Windows XP only, I'm getting a MemoryError exception in the socket
module when files are around 2.8 MB in size. This is on a PC with 500MB of
RAM, so memory shouldn't be an issue.
Here's the portion of code leading up to the error that is doing the
download:
url = urlparse.urlparse(uri)
netloc, path = url[1], url[2]
authHead = "Basic %s " % base64.encodestring("%s:%s"%(name, password))
conn = httplib.HTTPConnection(netloc)
conn.putrequest("GET", urllib.quote(path))
conn.putheader("Authorization", authHead)
conn.endheaders()
res = conn.getresponse()
if str(res.status)[:2] != '20':
conn.close()
raise ContentTransferError(res.status, res.reason, None)
data = res.read()
The exception is thrown in line 301 of socket.py on the line:
data = self._sock.recv(recv_size)
Are there any gotchas with XP that I should be aware of? Are there any extra
headers that I should be including here?
Many thanks,
Jamie
I have a Python 2.3.2 application that uses the httplib package to download
files. On Windows XP only, I'm getting a MemoryError exception in the socket
module when files are around 2.8 MB in size. This is on a PC with 500MB of
RAM, so memory shouldn't be an issue.
Here's the portion of code leading up to the error that is doing the
download:
url = urlparse.urlparse(uri)
netloc, path = url[1], url[2]
authHead = "Basic %s " % base64.encodestring("%s:%s"%(name, password))
conn = httplib.HTTPConnection(netloc)
conn.putrequest("GET", urllib.quote(path))
conn.putheader("Authorization", authHead)
conn.endheaders()
res = conn.getresponse()
if str(res.status)[:2] != '20':
conn.close()
raise ContentTransferError(res.status, res.reason, None)
data = res.read()
The exception is thrown in line 301 of socket.py on the line:
data = self._sock.recv(recv_size)
Are there any gotchas with XP that I should be aware of? Are there any extra
headers that I should be including here?
Many thanks,
Jamie