streaming popen to ftp.storbinary

Clark C. Evans cce at clarkevans.com
Wed Sep 25 00:50:50 EDT 2002


Hello.  I'm trying to pipe the output of a process 
created by popen3 through FTP to a file on a remote box.
Ideally, the process would block (so that a temporary
file isn't needed).

I have the following...

  (sin,sout,serr) = os.popen3( my_command, 'b' )  # binary stream
  ftp.storbinary("STOR %s " % filename, sout)

Anyway, if I go through an intermediate file, say by using 
os.system and piping to a temp file, and then using open() 
in the storbinary call it works.  

Also, this works under Win32 using ActiveState's python 2.2.1
but fails under version 2.2 compiled for FreeBSD.  Could this
be a version problem? 

Best,

Clark




More information about the Python-list mailing list