[BangPypers] ReadError: opening tar file

murugadoss murugadoss2884 at gmail.com
Fri Jun 4 12:45:29 CEST 2010


Thank for the reply.
The tar file is not corrupted, i am using the same file in 32-bit m/c and
able to extract it. I have attached this output also with the mail.
I am getting this problem only in 64-bit m/c.

output from 32-bit m/c:
tarfile.is_tarfile(tar)
func <bound method type.gzopen of <class 'tarfile.TarFile'>>
func1 <tarfile.TarFile object at 0xb7f028ac>
True

For reference i have tested the same in different systems.
--
Thanks & Regards
V.Murugadoss


On Fri, Jun 4, 2010 at 7:35 PM, Anand Balachandran Pillai <
abpillai at gmail.com> wrote:

> On Fri, Jun 4, 2010 at 11:27 AM, murugadoss <murugadoss2884 at gmail.com
> >wrote:
>
> > Hello,
> >
> > I am trying to extract a tar file. while doing this i check the valid tar
> > file using is_tarfile( ).
> > It is working fine in a 32-bit linux machine with python 2.5.4 version
> and
> > when i try it out in a 64-bit linux pc, i end up saying file is
> > invalid(false). This machine was using python 2.4 and now i have upgraded
> > to
> > 2.5.4 version and I am using python 2.5.4.
> >
> > I went through the library file, tarfile.py and found in is_tarfile(), is
> > opening the tarfile using tarfile.open.
> > >>>tar = /root/testtar.tar.gz
> > >>> import tarfile
> > >>> tarfile.is_tarfile(tar)
> > False
> > >>> tarfile.open(tar)
> > Traceback (most recent call last):
> >  File "<stdin>", line 1, in <module>
> >  File "/usr/local/lib/python2.5/tarfile.py", line 1153, in open
> >    raise ReadError("file could not be opened successfully")
> > tarfile.ReadError: file could not be opened successfully
> >
>
> I have a test tar file named f.tar.gz.
>
> >>> import tarfile
> >>> tarfile.open('f.tar.gz')
> <tarfile.TarFile object at 0x7f8a652fdad0>
> >>> tarfile.is_tarfile('f.tar.gz')
> True
>
> and for you,
>
> >>>tar = /root/testtar.tar.gz
> >>> import tarfile
> >>> tarfile.is_tarfile(tar)
> False
>
> So your "tar file" is not a real tar file. No wonder it is failing
> to open. Does it take rocket science to figure this out ?
>
>
> >
> > Can anyone please help me
> >
>
> Yes, only you can help yourself now. Spend time learning!
>
>
> >
> > --
> > Thanks & Regards
> > V.Murugadoss
> > _______________________________________________
> > BangPypers mailing list
> > BangPypers at python.org
> > http://mail.python.org/mailman/listinfo/bangpypers
> >
>
>
>
> --
> --Anand
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list