newbie : ftp auto-uncompress?

Buster Brown buster2642 at MailAndNews.com
Sat May 19 04:26:25 CEST 2001


I created a simple ftp download script (run on Linux) :

from ftplib import FTP 
File = open('fileName', 'w')  
ftp=FTP('this.that.nasa.gov')
ftp.login()
ftp.cwd('/go/to/new/sub/directory/')
ftp.retrbinary('RETR ' + 'fileName', File.write, 1024)
ftp.quit()
File.close

The script did what I wanted.  However, at the download site the filename is
actually 'fileName.Z'.  The file saved in my local directory is uncompressed
to text, as I want.  What function did the Unix 'uncompress', File.write? 
Is it due to my choice of 'fileName' and not 'fileName.Z' in the 2 lines?

I searched the Python documentation with no luck.  Any pointers/links to 
documentation about this much appreciated.

Chuck




More information about the Python-list mailing list