Help! calling tar from Python on Linux
Preston Landers
prestonlanders at my-deja.com
Mon Oct 11 11:38:18 EDT 1999
Hello all!
Thanks to everyone who responded to the thread about Python 2.0.
I'm back with a more pragmatic question this time.
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.
thanks,
---Preston
--
|| 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