[Tutor] Which Popen For Win32?
Hugo González Monteverde
hugonz-lists at h-lab.net
Wed Jun 15 17:01:48 CEST 2005
Hi, maybe you'll want to give a try to:
import commands
stat, outp = commands.getstatusoutput ("%s %s %s %s"%(zipCommand,
zipParameters, archive, fpath))
This will give you the exit code in stat and the whole text of the
putput in outp, so you may take a look at it. It's way simpler than popen.
Hugo
Gooch, John wrote:
> I am using the Winzip 9.0 Command Line Add-on to archive very large files (
> 1GB and over ) that are too large to be handled by Zipfile( this bug has
> been reported but not resolved ). I tried calling the external program using
> os.system(), but something about the output crashes my IDE ( Eclipse ), so I
> started looking for a way to run the external application without capturing
> the output, as I only care about the exit code ( 0 is good, anything else is
> bad ). Here is what I have to far:
>
> myCmd = os.popen( "%s %s %s %s" % ( zipCommand, zipParameters,
> archive,fpath ), 'w' )
> return myCmd.close()
>
> Currently, I have no idea what is being returned by the "close()" method, it
> doesn't appear to be the exit code, so perhaps it is the output of the
> command. If so, how can I capture and return the exit code?
>
> Thank You,
>
>
> John A. Gooch
> Systems Administrator
> IT - Tools
> EchoStar Satellite L.L.C.
> 9601 S. Meridian Blvd.
> Englewood, CO 80112
> Desk: 720-514-5708
>
>
>
>
> -----Original Message-----
> From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On Behalf
> Of Gary Taylor
> Sent: Tuesday, June 14, 2005 8:15 AM
> To: tutor at python.org
> Subject: Re: [Tutor] Passing command line argument in function
>
>
>
>>>
>>>ftp.storbinary(stor file_to_transfer, open(file_to_transfer,"r"))
>>>
>>
>>You need to create the command as a string: ftp.storbinary("stor " +
>>file_to_transfer,
>>open(file_to_transfer,"r"))
>>
>>Kent
>
>
> That worked perfectly, I was way off.
>
> Thank-you!
>
> Gary
>
> p.s. sorry for the out of thread message, my mail seems to
> be having problems.
>
More information about the Tutor
mailing list