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. Advertisements

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:
    572
    Andy Rechenberg
    Aug 27, 2003
  2. Sylvain Thenault
    Replies:
    2
    Views:
    619
    Sylvain Thenault
    Jan 18, 2005
  3. Bernhard Reimar Hoefle

    MemoryError Numarray

    Bernhard Reimar Hoefle, Sep 26, 2005, in forum: Python
    Replies:
    0
    Views:
    438
    Bernhard Reimar Hoefle
    Sep 26, 2005
  4. Replies:
    4
    Views:
    360
  5. Stephen G
    Replies:
    0
    Views:
    332
    Stephen G
    Oct 18, 2006
  6. Christoph Krammer

    MemoryError on reading mbox file

    Christoph Krammer, Sep 12, 2007, in forum: Python
    Replies:
    6
    Views:
    590
    Christoph Krammer
    Sep 13, 2007
  7. Laszlo Nagy
    Replies:
    1
    Views:
    7,239
    Mark Wooding
    Jan 27, 2009
  8. Steve Holden
    Replies:
    1
    Views:
    1,005
Loading...