Overflow error (was Vol 67, Issue 192)

Discussion in 'Python' started by Dave Angel, Apr 13, 2009.

  1. Dave Angel

    Dave Angel Guest

    Ryniek90 wrote:
    > <div class="moz-text-flowed" style="font-family: -moz-fixed">Chris
    > Rebert pisze:
    >> On Sun, Apr 12, 2009 at 3:38 PM, Ryniek90 <> wrote:
    >>>> Paul Rubin <http://>
    >>>> Ryniek90 <> writes:
    >>>>
    >>>>> When i wanted to send an .iso file of 4GB length, i had traceback:
    >>>>> "OverflowError: requested number of bytes is more than a Python
    >>>>> string
    >>>>> can hold"
    >>>>>
    >>>> You're not supposed to put the 4GB all in one string. Open the
    >>>> socket and send smaller packets through it.
    >>>>
    >>>> ------------------------------------------------------------------------
    >>>>
    >>> Ok, so i will split that data for smaller files. But i've still
    >>> haven't got
    >>> answer for question: "What's the max. length of string bytes which
    >>> Python
    >>> can hold?

    >>
    >> sys.maxsize
    >> The largest positive integer supported by the platform’s
    >> Py_ssize_t type, and thus the maximum size lists, strings, dicts, and
    >> many other containers can have.
    >>
    >> Cheers,
    >> Chris
    >>

    >
    > Thanks. I've wanted to check very carefully what's up, and i found
    > this: "strings (currently restricted to 2GiB)".
    > It's here, in PEP #353 (PEP 0353
    > <http://www.python.org/dev/peps/pep-0353/>). Besides of this, i've
    > found in sys module's docstring this:
    >
    > maxint = 2147483647
    > maxunicode = 1114111
    >
    > Which when added gives us 2148597758.0 bytes, which are equal to
    > 2049.0624980926514 MiB's.
    > So files larger than 2049.06 MiB's should be splitted into smaller
    > ones and sent partially.
    > Correct me if i'm wrong.
    >
    >
    > </div>
    >

    How much RAM is in your system? Unless it's at least 50 gb, in a 64bit
    OS, I'd keep my max chunk size to much smaller than 2gb. For a typical
    32bit system with 2 to 4gb of RAM, I'd probably chunk the file a meg or
    so at a time. Using large sizes is almost always a huge waste of resources.
    Dave Angel, Apr 13, 2009
    #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. Replies:
    5
    Views:
    475
  2. Raul Rodriguez

    ASP error in pm.asp line 192

    Raul Rodriguez, Dec 5, 2005, in forum: ASP General
    Replies:
    2
    Views:
    101
    Raul Rodriguez
    Dec 6, 2005
  3. Raul Rodriguez
    Replies:
    6
    Views:
    140
    Raul Rodriguez
    Dec 14, 2005
  4. john maclean

    make error during svn build (192)

    john maclean, Apr 6, 2009, in forum: Ruby
    Replies:
    2
    Views:
    121
    Nobuyoshi Nakada
    Apr 6, 2009
  5. Morten Engvoldsen

    Re: Python-list Digest, Vol 113, Issue 192

    Morten Engvoldsen, Feb 23, 2013, in forum: Python
    Replies:
    0
    Views:
    85
    Morten Engvoldsen
    Feb 23, 2013
Loading...

Share This Page