Help! calling tar from Python on Linux

Preston Landers prestonlanders at my-deja.com
Mon Oct 11 16:03:58 EDT 1999


BTW, just in case anyone is wondering, NO, I am not out of space on the
device.  However, the directories I'm working with are mounted via NFS
and it's quite possible that it's NFS weirdness related.

thanks,

---Preston

In article <7tt098$7i$1 at nnrp1.deja.com>,
  Preston Landers <prestonlanders at my-deja.com> wrote:

> I'm trying to untar a large file from within a Python script.
>
> I'm calling tar like this:
>
> filename = "/tmp/data.tar.gz"
>
> status, result = commands.getstatusoutput("tar xzvf %s" % filename)
>
> if status:
>    print "error! tar said:\n%s" % result
>
> else:
>    # continue
>
> The problem is that every time I get an error status from tar, though
> tar seems to completely extract all files.  I get this as the last 2
> lines of output:
>
> gzip: stdout: Broken pipe
> tar: Child returned status 1
>
> If I try to perform this same operation from the command line, it
works
> fine.  But if I try to do it in Python, I get this error status.  Has
> anybody seen anything like this?
>
> Like I said, all the data seems to extract fine.  It's just that my
> program looks for the non-zero error condition and stops there.

--
|| Preston Landers <prestonlanders at my-deja.com> ||


Sent via Deja.com http://www.deja.com/
Before you buy.




More information about the Python-list mailing list