Question: How to execute an EXE with Python?
peter at engcorp.com
Wed Aug 28 05:05:05 CEST 2002
"Fausto Arinos de A. Barbuto" wrote:
> Hi Peter,
> Now it is working: here is the code.
> import os
> That os.system('c:/fausto/execs/teste.exe') doesn't work.
Ah, James hit on the real problem. While Python loves
forward slashes, and parts of Windows can even handle it,
the command interpreter does not like them at all, except
as option flags (where Unix mostly uses "-").
Thus this should have worked:
Note the "r" before the quotation marks. Without that, you
would need to double up every backslash to avoid them being
interpreted as escape characters for the following character,
with things like "\t" becoming TAB characters, for example.
More information about the Python-list