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

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <chris@rebertia.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'output': 0.04; '64-bit': 0.07; 'arguments': 0.07; 'exit': 0.07; 'try:': 0.07; 'python': 0.09; 'explanation': 0.09; 'cc:addr:python-list': 0.10; '2.7': 0.13; '9:15': 0.16; 'created.': 0.16; 'exe': 0.16; 'subject:exe': 0.16; 'subprocess': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'code,': 0.18; 'versions': 0.20; 'import': 0.21; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'skip:( 20': 0.28; 'chris': 0.28; '(used': 0.29; 'code': 0.31; 'file': 0.32; 'instead,': 0.33; 'anyone': 0.33; 'received:google.com': 0.34; 'but': 0.36; 'guidance': 0.36; 'subject:with': 0.36; 'execute': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'some': 0.38; '30,': 0.62; 'different': 0.63; 'offer': 0.65; '2013': 0.84; 'sender:addr:chris': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=QG1aysYftye9jtjfoGHLOPEx+LepzUcyvpGsmYo/3FY=; b=SEWXgoG1CffaZqSxK7Jcf6lkHq4gTMtZ15AQRu80qAYRN3BXvaGcFmrkGG2NKHnufY qR/fqyXfon2XJ3+b3V3aTHYmldYgFgsfwTuVWaio5xc9WDeGBWEv6zL1w5yaPf2W0ajU 6rs/U/GpgmjEKNjfpukxPysebnzEJE2GD9UGU=
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=QG1aysYftye9jtjfoGHLOPEx+LepzUcyvpGsmYo/3FY=; b=CURPl7cNOSjrVfuSth58AeM2cm5bBa9V+aZjUAxmF/1S5py6MzF8KaEx1gVEnuZBjQ 1yPQFkxAZZVC92kBkWTvRyYJ5QjjZf6D5v/dFzvpjhrNwdMKOE8v3Mdk0O5rGC2XKtbX HXaZMQRGena+HOOZuwxowTXy7/4H3x9A6yvnb6kMqN98XnaJ+ckFv5Xo0UAnc5gi09NG 4URm3lFVyuLaX7h/tNaqQVIbDVBKDNhgXBrGLeLXNH5NhKAn/VTTLg96lkSkXgktp8pN q6BGQp8mhHCqhSdQv6app4tNu/Sbylikz1mvNRQytXku7PrjQQQCKe4HF0ezIjlQjywg g6hQ==
MIME-Version 1.0
X-Received by 10.50.150.239 with SMTP id ul15mr4055602igb.93.1359568644441; Wed, 30 Jan 2013 09:57:24 -0800 (PST)
Sender chris@rebertia.com
In-Reply-To <7c1ddf67-5a76-4e11-8ff9-1a60ef35d102@googlegroups.com>
References <7c1ddf67-5a76-4e11-8ff9-1a60ef35d102@googlegroups.com>
Date Wed, 30 Jan 2013 09:57:24 -0800
X-Google-Sender-Auth gfp5xbMZFVn1x-htUYIe1Wh6GCs
Subject Re: how to use subprocess to execute an exe with args and an output
From Chris Rebert <clp2@rebertia.com>
To noydb <jenn.duerr@gmail.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Gm-Message-State ALoCoQmcueVQVAQeJvdEygJUZrQx8rRPDzbBmgnsjFxib36sxYDymmT/C12xK1ioj4naVbeMIiu5
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1218.1359568648.2939.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1359568648 news.xs4all.nl 6856 [2001:888:2000:d::a6]:46885
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:37948

Show key headers only | 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