Gzip -> FTP w/o using a temporary file

Joel Burton pup at pobox.com
Mon Apr 24 21:31:24 CEST 2000


I'm writing a small program to help users move a large file. Since I can't
predict what FTP command-line programs they will have, it's being written as
part of a python script.

I have a simple working solution using gzip and ftplib. I create a new file
and gzip it w/Python's gzip lib, then send it using ftplib's ftp. However,
in doing this, I end up creating a real gzipped file.

Since ftplib has me sending a file using a file descriptor, it would appear
that I could gzip -> fd -> FTP, w/o the overhead and space of creating a
real file. However, I'm stuck trying to get this to work.

I tried using os.pipe() to create an r/w pipe, but the 'w' part of the pipe
isn't writable, according to gzip.GzipFile()

Has anyone a clue?

Thanks in advance.






More information about the Python-list mailing list