472,364 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,364 software developers and data experts.

execute commands independantly

Hi,

I am trying to execute an executable or a pyton script inside my
program. I looked at the subprocess and os module. But all the
functions in these modules blocks my application. What I want to do is
run the subprocess without any concern. I don't care of its return type
or child signals. Just start and let it run independantly.

Thanks,
Mike

Sep 6 '05 #1
5 1216
Mike Tammerman wrote:
Hi,

I am trying to execute an executable or a pyton script inside my
program. I looked at the subprocess and os module. But all the
functions in these modules blocks my application.


subprocess doesn't block unless you call .wait():

from subprocess import Popen
proc = Popen('sleep 2; echo "Hello, world!"', shell=True)
print "In two seconds, something will happen."
proc.wait()
print "Did you see that?"
Sep 6 '05 #2

Mike Tammerman wrote:
I am trying to execute an executable or a pyton script inside my
program. I looked at the subprocess and os module. But all the
functions in these modules blocks my application. What I want to do is
run the subprocess without any concern. I don't care of its return type
or child signals. Just start and let it run independantly.


If you don't need any output, os.system('app') should do.

Sep 6 '05 #3

If you want it to return when the program is finished then use
os.system('app') but if you just want to start it and return right
away, use os.startfile('app')

Sep 6 '05 #4
You're right,

I tried subprocess.call and os.spawn* functions. Popen is what I will
be happy with.

Thanks a lot.

Mike

Sep 6 '05 #5
On 6 Sep 2005 08:07:12 -0700, Eric McGraw <th************@gmail.com> wrote:

If you want it to return when the program is finished then use
os.system('app') but if you just want to start it and return right
away, use os.startfile('app')


That one is Windows-only, though -- at least in 2.3 where I live. The
os.spawn* family of calls are more portable, but I'm not sure it's a good
idea to just spawn-and-forget a process.

/Jorgen

--
// Jorgen Grahn <jgrahn@ Ph'nglui mglw'nafh Cthulhu
\X/ algonet.se> R'lyeh wgah'nagl fhtagn!
Sep 6 '05 #6

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

Similar topics

3
by: Lance | last post by:
Hi All, I would like to read commands from a file and execute them in VB, something like reading str = "hello world" into VB and execute it. Any suggestions will be appreciated. Thanks, Lance
2
by: news.microsoft.com | last post by:
Good morning everybody, How can I use WScript.Shell to execute Ms-DOS commands and can I see the outputs commands in the asp page? In the past, using Win. NT 4 Server and cmd..shell attribute...
15
by: Madhanmohan S | last post by:
Hi All, I want to run a command line appplication from C#. When i start the application, it will go into specific mode. After that, i have to give commands to use the application. How Can This Be...
6
by: zoltix | last post by:
Hi, I would like to access to execute specific commands but the privileges are not enough from an aspx Page. Because this service run as IU_IISSERVER, therefore aspx hasn’t access to these...
4
by: Chr1s | last post by:
How do I execute a crontab command using php (not CLI) as user Joe? I don't have any problem getting output from commands such as 'ls' using passthru and exec but I am stumped with crontab. ...
15
by: tmp123 | last post by:
Hello, Thanks for your time. We have very big files with python commands (more or less, 500000 commands each file). It is possible to execute them command by command, like if the commands...
2
by: sajalsajal | last post by:
how can i read and execute VB6 commands from a text file (like INI file) like a VBScript but not actually a vbscript. evaluate commands from a text file
1
by: raocheng | last post by:
Please see the following code. Suppose I have many shell commands to be executed. And I don't want to fork a sub shell for each command(eg: status,output = commands.getstatusoutput(cmd)) because...
2
by: rcook349 | last post by:
I'm trying to automate our builds and publishes of our Windows application (deployed to a website via ClickOnce). I'm getting close, I think, on the commands I need to execute. However, how do...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

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.