
October 9th, 2012, 07:53 AM
|
|
Registered User
|
|
Join Date: Oct 2011
Posts: 29
Time spent in forums: 5 h 39 m 44 sec
Reputation Power: 0
|
|
|
Some wield problem
I just want to decompress a bz2 file and wrote a short script but
it can't work. just the error: compressed file ended before the logical end-of-stream was detected
I don't know how to fix it.Help me,please.
Code:
import bz2
import os.path
file_path = raw_input('input the compressed filename:\n')
filename = os.path.basename(file_path)
dest_path = raw_input('input the dest path.\n')
dest_file = os.path.join(dest_path,filename)
f = bz2.BZ2File(filename,'rU')
ff = open(dest_file,'w')
for line in f.readlines():
ff.write(line)
f.close()
ff.close()
|