On Thu, May 27, 2010 at 6:51 AM, murugadoss <murugadoss2...@gmail.com>wrote:
> Hello, > Thanks for the Reply. > I am able to extract the file manually, using "tar -xzvf sample.tar.gz" > command. > Probably needs a "r;gz" mode instead of just "r" >From the tarfile module doc : tarfile.open(*name=None*, *mode='r'*, *fileobj=None*, *bufsize=10240*, * **kwargs*)ΒΆ <http://docs.python.org/library/tarfile.html#tarfile.open> Return a TarFile<http://docs.python.org/library/tarfile.html#tarfile.TarFile>object for the pathname *name*. For detailed information on TarFile<http://docs.python.org/library/tarfile.html#tarfile.TarFile>objects and the keyword arguments that are allowed, see *TarFile Objects*<http://docs.python.org/library/tarfile.html#tarfile-objects> . *mode* has to be a string of the form 'filemode[:compression]', it defaults to 'r'. Here is a full list of mode combinations: mode action 'r' or 'r:*' Open for reading with transparent compression (recommended). 'r:' Open for reading exclusively without compression. * 'r:gz'* *Open for reading with gzip compression.* 'r:bz2' Open for reading with bzip2 compression. > -- > Thanks & Regards > V.Murugadoss > > > On Thu, May 27, 2010 at 10:09 AM, Dhananjay Nene > <dhananjay.n...@gmail.com>wrote: > > > Instinctively, the error seems to be opening the file and not with the > > tarfile decoding. > > You may want to check if open("sample.tar.gz","r") works. > > > > Dhananjay > > > > On Thu, May 27, 2010 at 6:19 AM, murugadoss <murugadoss2...@gmail.com > > >wrote: > > > > > Hi all, > > > > > > I am trying to extract tar.gz file using python script. when i do so, i > > get > > > an error, > > > > > > tar = tarfile.open("sample.tar.gz","r") > > > 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 > > > > > > can anyone say me, what this error exactly and how to solve this? > > > > > > Thanks in advance > > > -- > > > Thanks & Regards > > > V.Murugadoss > > > _______________________________________________ > > > BangPypers mailing list > > > BangPypers@python.org > > > http://mail.python.org/mailman/listinfo/bangpypers > > > > > > > > > > > -- > > -------------------------------------------------------- > > blog: http://blog.dhananjaynene.com > > twitter: http://twitter.com/dnene > > _______________________________________________ > > BangPypers mailing list > > BangPypers@python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- -------------------------------------------------------- blog: http://blog.dhananjaynene.com twitter: http://twitter.com/dnene _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers