Re: [Tutor] Pipe variable to external command (solved)

2005-05-15 Thread Jeffrey Rice
At 04:29 PM 5/15/2005, Danny Yoo wrote: > > clamav.fromchild.close > ^^ >Careful: you may need parens there on your 'close' line. (clothesline? >*grin*) > >As written, that last statement doesn't fire off the close() method. >This might be suprising because some other languag

Re: [Tutor] Pipe variable to external command (solved)

2005-05-15 Thread Danny Yoo
> Here is what the code I settled on looks like: > > ### > working = email.message_from_file(open(emailfile)) > > clamav = popen2.Popen3(clamav_cmd,1) > clamav.tochild.write(working.as_string()) > clamav.tochild.close() > clamav_result = clamav.fromchild.read().lstrip('stream: ') > clamav.fromchi

Re: [Tutor] Pipe variable to external command (solved)

2005-05-15 Thread Jeffrey Rice
At 04:17 PM 5/13/2005, Alan Gauld wrote: >AS a general pont all uppercase usually means a consrtant in Python. >Variable names typically start lowercase and either use capital >letters to separate words likeThis, or use underscores like_this. > >Variables starting with an uppercase letter tend to i

Re: [Tutor] Pipe variable to external command (fwd)

2005-05-12 Thread Danny Yoo
> http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/68786 > As a work around, I end up calling popen3 like this: > > Open3.popen3 ("/some/command/to/run ; echo $? 1>&2") { ... } > > That ensures the exit code from /some/command/to/run will be the last > line of the standard error stream from

Re: [Tutor] Pipe variable to external command (fwd)

2005-05-12 Thread Jeffrey Rice
At 11:56 AM 5/12/2005, Danny Yoo wrote: >* * * * >CLAMAV_out, CLAMAV_in, CLAMAV_err= popen2.popen3(CLAMAV) >CLAMAV_in.write(WORKING) >CLAMAV_in.close() >CLAM_RESULT=CLAMAV_out.read() >CLAMAV_out.close() >CLAM_ERR=CLAMAV_err.read() >CLAMAV_err.close() >* * * * > >CLAM_RESULT gives the correct reply

Re: [Tutor] Pipe variable to external command (fwd)

2005-05-12 Thread Danny Yoo
-- Forwarded message -- Date: Thu, 12 May 2005 11:31:57 -0600 From: Jeffrey Rice <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Pipe variable to external command At 12:16 AM 5/12/2005, Danny Yoo wrote: >## > >>> c

Re: [Tutor] Pipe variable to external command

2005-05-11 Thread Danny Yoo
On Wed, 11 May 2005, Jeffrey Rice wrote: > I am having a little problem with how to pipe a variable's contents to an > external command. Essentially, I have a variable that contains the > contents of a variable that I want to feed to a series of external commands > (clamav and spamassassin).

[Tutor] Pipe variable to external command

2005-05-11 Thread Jeffrey Rice
Hi, I am working on getting comfortable with Python, and am trying to rewrite some of my old (clumsy) bash scripts into python. I am having a little problem with how to pipe a variable's contents to an external command. Essentially, I have a variable that contains the contents of a variable t