MemoryError in socket.py on Windows XP

Discussion in 'Python' started by Jamie, Nov 27, 2003.

  1. Jamie

    Jamie Guest

    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
    Jamie, Nov 27, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy Rechenberg
    Replies:
    0
    Views:
    462
    Andy Rechenberg
    Aug 27, 2003
  2. Laszlo Nagy
    Replies:
    1
    Views:
    4,739
    Mark Wooding
    Jan 27, 2009
  3. Jean-Paul Calderone
    Replies:
    0
    Views:
    936
    Jean-Paul Calderone
    Jan 27, 2009
  4. Laszlo Nagy
    Replies:
    0
    Views:
    516
    Laszlo Nagy
    Feb 1, 2009
  5. Steve Holden
    Replies:
    0
    Views:
    638
    Steve Holden
    Feb 1, 2009
Loading...

Share This Page