473,657 Members | 2,435 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to run a dos executable from python

I have an executable (e.g. myprog.exe) which takes some set number of
arguments.

This command works ok:
os.system(r"c:\ tmp\myprog.exe arg1 arg2 arg3")

The problem is that the path to the program and the arguments are
variable at runtime so I need to pass them as arguments.

Thanks


Jan 26 '06 #1
1 1606
lblr33 wrote:
I have an executable (e.g. myprog.exe) which takes some set number of
arguments.

This command works ok:
os.system(r"c:\ tmp\myprog.exe arg1 arg2 arg3")

The problem is that the path to the program and the arguments are
variable at runtime so I need to pass them as arguments.

Thanks

Take a look at the subprocess module or on older versions of Python
you can use os.spawn.

Larry Bates
Jan 26 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3978
by: lamar_air | last post by:
I have a fortran executable which when run from cmd it asks for a series of parameters which you enter then hit enter. From my python cgi script i want to be able to run the executable. Enter the 4 or 5 parameters needed then end the executable and redirect to another web page which will display some results given from an output file from the fortran executable. When the user clicks submit on the form it seems to hang up on the...
3
2556
by: Nickolay | last post by:
it's easy to create small executable from python code, when using assembler compilers. I ask you if need it?
4
4712
by: Torsten Mohr | last post by:
Hi, i'd like to build an executable file that is linked with a python library and executes a script via PyRun_SimpleString or similar functions. Is there a static library of python available, so the users don't need to install python?
4
2465
by: presentt | last post by:
Hello, I'm running Ubuntu Linux 5.04. I just started teaching myself Python today, and have been reading a few things to get started. I came across something in one (namely http://docs.python.org/tut/node4.html#SECTION004220000000000000000) that confused me a little. It says:
1
2176
by: Will Ware | last post by:
I am trying to freeze a static executable. I built a static Python executable this way: ./configure --disable-shared --prefix=/usr/local make make install Even that didn't give me a really static executable, though: $ ldd /usr/local/bin/python linux-gate.so.1 => (0xffffe000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb7f44000) libdl.so.2 => /lib/libdl.so.2 (0xb7f40000)
5
2310
by: Avi Kak | last post by:
Folks, Does regular expression processing in Python allow for executable code to be embedded inside a regular expression? For example, in Perl the following two statements $regex = qr/hello(?{print "saw hello\n"})mello(?{print "saw mello\n"})/; "jellohellomello" =~ /$regex/;
28
20570
by: Tim Daneliuk | last post by:
I have a program wherein I want one behavior when a file is set as executable and a different behavior if it is not. Is there a simple way to determine whether a given named file is executable that does not resort to all the lowlevel ugliness of os.stat() AND that is portable across Win32 and *nix? Thanks, ---------------------------------------------------------------------------- Tim Daneliuk tundra@tundraware.com PGP Key: ...
3
3944
by: Jeffrey Froman | last post by:
Hello All, I have two python versions installed, one in /usr/bin, and one in /usr/local/bin. However, when invoking python without a full path, I get the wrong executable with the right sys.executable string! ---------------------------------------------------------------------------- # ls -l /usr/local/bin/python* -rwxr-xr-x 2 root root 3783810 Jul 19 09:15 /usr/local/bin/python -rwxr-xr-x 2 root root 3783810 Jul 19 09:15...
7
3568
by: DanielJohnson | last post by:
I have a small project which has around 10 .py files and I run this project using command line arguments. I have to distribute this project to somebody. I was wondering how can I make an executable or some kind of installer, so that end user doesn't need to compile and worry if he/ she has Python installed or not ? Every help is greatly appreciated.
2
1539
by: walterbyrd | last post by:
I have heard about Pysco. But does create a single executable that can run without Python being installed? Or does that just compile the libraries?
0
8826
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4306
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.