Need help for the error "OverflowError: long int too large to convert to int"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • khgoh
    New Member
    • Aug 2007
    • 1

    Need help for the error "OverflowError: long int too large to convert to int"

    Hi,

    Need help for the error "OverflowEr ror: long int too large to convert to int" while reading a zip file content.
    Python version:
    Python 2.4.1 (#1, Sep 13 2005, 00:39:20)
    [GCC 4.0.2 20050901 (prerelease) (SUSE Linux)] on linux2

    Code
    >>> import os, datetime, sys, optparse, string, operator, gzip
    >>> health_day_summ ary_file = gzip.GzipFile( "health_CORR_su mmary.csv.gz", "rb")
    >>> lot_source_cont ents = health_day_summ ary_file.readli nes()

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "/usr/lib/python2.4/gzip.py", line 413, in readlines
    line = self.readline()
    File "/usr/lib/python2.4/gzip.py", line 387, in readline
    c = self.read(reads ize)
    File "/usr/lib/python2.4/gzip.py", line 224, in read
    self._read(read size)
    File "/usr/lib/python2.4/gzip.py", line 265, in _read
    buf = self.fileobj.re ad(size)
    OverflowError: long int too large to convert to int


    Thanks in advance
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Looks likehealth_day_ summary_file is not a text file.

    file.readlines( ) is for reading newline terminated text into a list of newline terminated strings.

    Comment

    Working...