Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #37948

Re: how to use subprocess to execute an exe with args and an output

References <7c1ddf67-5a76-4e11-8ff9-1a60ef35d102@googlegroups.com>
Date 2013-01-30 09:57 -0800
Subject Re: how to use subprocess to execute an exe with args and an output
From Chris Rebert <clp2@rebertia.com>
Newsgroups comp.lang.python
Message-ID <mailman.1218.1359568648.2939.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Jan 30, 2013 at 9:15 AM, noydb <jenn.duerr@gmail.com> wrote:
> I am looking for some guidance on using subprocess to execute an EXE with arguments and an output.  The below code works in that it returns a 0 exit code, but no output file is created.  I have tried a few different versions of this code (used Popen instead, some stderr/stdout), but no luck.  Can anyone offer an explanation or suggestion?  (GPSBabel is freeware)
> Python 2.7 on windows7 64-bit
>
> import subprocess
> subprocess.call([r"C:\Program Files (x86)\GPSBabel\gpsbabel.exe",
>                 "-i", "gdb", "-f", r"C:\Temp\GDBdata\testgps28.gdb",
>                 "-o", "gpx", r"C:\Temp\gpx\test28output.gpx"])

If my cursory reading of GPSBabel's documentation is right, you're
missing a "-F" before the output filepath. Try:

subprocess.call([
    r"C:\Program Files (x86)\GPSBabel\gpsbabel.exe",
    "-i", "gdb",
    "-f", r"C:\Temp\GDBdata\testgps28.gdb",
    "-o", "gpx",
    "-F", r"C:\Temp\gpx\test28output.gpx",
])

Regards,
Chris

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

how to use subprocess to execute an exe with args and an output noydb <jenn.duerr@gmail.com> - 2013-01-30 09:15 -0800
  Re: how to use subprocess to execute an exe with args and an output noydb <jenn.duerr@gmail.com> - 2013-01-30 09:19 -0800
  Re: how to use subprocess to execute an exe with args and an output Chris Rebert <clp2@rebertia.com> - 2013-01-30 09:57 -0800
  Re: how to use subprocess to execute an exe with args and an output MRAB <python@mrabarnett.plus.com> - 2013-01-30 18:11 +0000
  Re: how to use subprocess to execute an exe with args and an output noydb <jenn.duerr@gmail.com> - 2013-01-30 10:40 -0800
  Re: how to use subprocess to execute an exe with args and an output Terry Reedy <tjreedy@udel.edu> - 2013-01-30 14:58 -0500

csiph-web