Problem untaring python2.5
Shane Geiger
sgeiger at ncee.net
Thu Dec 20 03:47:48 EST 2007
You might want to try an all-python implementation for sanity testing.
I haven't tested this snippet much. I am not sure it handles nested
files all that well.
import tarfile
tar = tarfile.open("TarTest.tar.gz2", "r:gz") # other options:
"r:bz2", and ??
file_list = tar.getnames()
import os
os.mkdir('new_dir')
# write the files out to new files
for fname in tar.getnames():
# extract/decompress the data of each file
data = tar.extractfile(fname).read()
# optionally change the filename
new_file = "new_dir/" + fname
print "File %s written!" % new_file
# write the decompressed data to a file
fout = open(new_file, "w")
fout.write(data)
fout.close()
# done, close the tar file ...
tar.close()
> On Dec 19, 12:16 pm, samuel.pro... at gmail.com wrote:
>
>> Hello,
>>
>> It is not possible to give sharp hints without more relevant
>> information like:
>> - What is your platform?
>> - Which version of python?
>> - What is the version of: $tar--version (GNUtar, other proprietarytar, according to my personal experience, AIXtarmay fail)
>> - Is your disk full or do you have the correct permissions with your
>> current user?
>>
>> ++
>>
>> Sam
>>
>
> Hi Sam ,
> I am using windows server 2003, python2.5.1 and version 1.16 of tar
>
> and as per disk full issues i dont think that my systems hard disk is
> full
>
>
--
Shane Geiger
IT Director
National Council on Economic Education
sgeiger at ncee.net | 402-438-8958 | http://www.ncee.net
Leading the Campaign for Economic and Financial Literacy
More information about the Python-list
mailing list