passing command line arguments to executable

mcanjo mcanjo at gmail.com
Mon Apr 5 12:22:12 EDT 2010


On Apr 4, 6:32 am, Simon Brunning <si... at brunningonline.net> wrote:
> On 3 April 2010 18:20, mcanjo <mca... at gmail.com> wrote:
>
> > I tried doing the following code:
>
> > from subprocess import Popen
> > from subprocess import PIPE, STDOUT
> > exefile = Popen('pmm.exe', stdout = PIPE, stdin = PIPE, stderr =
> > STDOUT)
> > exefile.communicate('MarchScreen.pmm\nMarchScreen.out')[0]
>
> > and the Command Prompt opened and closed, no exceptions were generated
> > but the program didn't run. Am I doing something wrong?
>
> Have you tried running pmm.exe from the command line? What does that
> look like? Does it matter what the current working directory is at the
> time?
>
> --
> Cheers,
> Simon B.

When I run the program from the command line it looks as follows:

Enter the Input filename
(enter in filename here)
Enter the Output filename
(enter in filename here)

If an absolute path is not specified then the output file is located
in the current working directory of the executable. The absolute path
for the output and input files may be specified also.

Chris



More information about the Python-list mailing list