[BangPypers] ReadError: opening tar file
Sridhar Ratnakumar
sridhar.ratna at gmail.com
Tue Jun 8 06:02:06 CEST 2010
On Sun, Jun 6, 2010 at 6:10 PM, murugadoss <murugadoss2884 at gmail.com> wrote:
> 1.
> This is regarding installing python in 64-bit linux pc. one of the issue,
> which we were talking earlier. It was recommended to install python with
> 32-bit gcc compiler in 64-bit m/c.
> step:
> while installing python in 64-bit m/c, try using
> export CC='gcc -m32'
> ./configure --prefix = "installing directory" ; make ; make install
Alternatively, you can directly get the pre-compiled binaries for
Linux 64-bit from ActiveState (where I work):
http://www.activestate.com/activepython/downloads
> 2.
> coming to extracting tarfile :
> I am able to extract a *.tar file using tarfile.extractall( ) .The same when
> i try extracting *.tar.gz,check tarfile.is_tarfile( ) returning false. On
> debugging, i found in ../lib/tarfile.py + 1148 (open function) where it
> checks the file type and returns the file attributes is failing.
Ok.
> Exactly
> telling " *return func(name, "r", fileobj)* " This line is failing [...]
If it is failing, put a `print` statement in the next `except` block
and print the exception msg. Something like:
try:
return func(name, "r", fileobj)
except (ReadError, CompressionError), e:
print e
if fileobj is not None:
fileobj.seek(saved_pos)
continue
>[...] or returning none.
No. What is the clear is that at least one of the calls to `func(name,
"r", fileobj)` is not returning at all, thus raising an exception.
Otherwise, you will not get this error you mentioned earlier:
`tarfile.ReadError: file could not be opened successfully`.
So find out the exception message raised by `func(name, "r", fileobj)`
for one of the open calls.
> 3.on other Method,
> i open the file using tarfile.open(*.tar.gz,"r:gz"). I am getting an error
> as "ImportError: No module named zlib".
>
>>>import tarfile
>>>tarfile.open("*.tar.gz","r:gz")
> ImportError: No module named zlib
You must not have built Python with zlib.
-srid
More information about the BangPypers
mailing list