newbie : ftp auto-uncompress? 
Author Message
 newbie : ftp auto-uncompress?

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



Wed, 05 Nov 2003 10:26:25 GMT  
 newbie : ftp auto-uncompress?
AFAIK, the server did it. Your ftp object received uncompressed text.

HTH,

Sandipan

Quote:
----- Original Message -----

Newsgroups: comp.lang.python

Sent: Saturday, May 19, 2001 7:56 AM
Subject: newbie : ftp auto-uncompress?

> 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

> --
> http://mail.python.org/mailman/listinfo/python-list



Wed, 05 Nov 2003 11:13:12 GMT  
 newbie : ftp auto-uncompress?

Quote:
> AFAIK, the server did it. Your ftp object received uncompressed text.
    ...
> > 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.

Yep -- it's the server.  Very popular extensions to the FTP protocol
(on-the-fly compression, decompression, archiving, ...) have the
FTP server interpret the requested filename and "do what you mean".

http://www.webcom.com/help/ftp/compression.shtml has a good
and simple guide to these features as provided by wu-ftp, for ex.

Python has little to do with it...!-)

Alex



Wed, 05 Nov 2003 16:02:38 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Auto-launch CD? (newbie)

2. Exept ST/X Auto-starting (newbie question).

3. Squeak FTP site established: ftp://ftp.create.ucsb.edu/pub/Smalltalk/Squeak

4. My ftp site (ftp://ftp.iag.net/pub/clipper)

5. Uncompress Blinked Exe

6. forth83 won't uncompress

7. Compress/Uncompress Algorithm

8. UNCOMPRESS in Fortran?

9. Can't uncompress smalltalk

10. newbie has ftp question

11. Q: ftp.retrlines problem (newbie)

12. newbie doubt about tcllib's ftp module

 

 
Powered by phpBB® Forum Software