[Tutor] Tutor Digest, Vol 108, Issue 22
3n2solutions at gmail.com
Wed Feb 6 23:02:27 CET 2013
On Wed, Feb 6, 2013 at 3:00 AM, <tutor-request at python.org> wrote:
> Send Tutor mailing list submissions to
> tutor at python.org
> To subscribe or unsubscribe via the World Wide Web, visit
> or, via email, send a message with subject or body 'help' to
> tutor-request at python.org
> You can reach the person managing the list at
> tutor-owner at python.org
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Tutor digest..."
> Today's Topics:
> 1. Re: help with running perl script that writes to a text file
> (Peter Otten)
> 2. Re: help with running perl script that writes to a text file
> Message: 1
> Date: Wed, 06 Feb 2013 11:12:54 +0100
> From: Peter Otten <__peter__ at web.de>
> To: tutor at python.org
> Subject: Re: [Tutor] help with running perl script that writes to a
> text file
> Message-ID: <ketaav$cm5$1 at ger.gmane.org>
> Content-Type: text/plain; charset="ISO-8859-1"
> 3n2 Solutions wrote:
>> I want to automate the following manual process from DOS promp:
>> c:/scripts/perl>perl fix.pl base.gtx >base.txt
>> Here is my python script:
>> subprocess.call(['perl','fix.pl','base.gtx >base.txt',path])
>> I also tried this alternative:
>> subprocess.Popen(['perl','fix.pl','base.gtx >base.txt',path]) #same
>> result from this method.
>> The above script generates the base.txt file but has no content in it.
>> any ideas as to why the resulting text file is empty? Am I using the
>> correct python commands to run the above manual process?
> I'm surprised that base.txt is generated at all, I'd expect fix.pl to look
> for a file named "base.gtx >base.txt" and complain when it doesn't find
> I think the following should work:
> with open("c:/scripts/perl/base.txt", "w") as f:
Peter, that did it! Thank you.
More information about the Tutor