» How do I run another script in Python without waiting for it to finish?
How do I run another script in Python without waiting for it to finish?
|February 13, 2009
Posted by forumadmin
I am creating a little dashboard for a user that will allow him to run specific jobs. I am using Django so I want him to be able to click a link to start the job and then return the page back to him with a message that the job is running. The results of the job will be emailed to him later.
I believe I am supposed to use
subprocess.Popen but I’m not sure of that. So in pseudocode, here is what I want to do:
if job == 1:
run script in background: /path/to/script.py
return 'Job is running'
More Related Questions
- Node.js as a background service I want my node.js server to run in the background, ie: when I close my terminal I want my server to keep running. I've googled this and came up with this tut, however it doesn't work as […]
- How to spawn parallel child processes on a multi-processor system? I have a Python script that I want to use as a controller to another Python script. I have a server with 64 processors, so want to spawn up to 64 child processes of this second Python […]
- Python: sequential calls to subprocess (in this case, espeak) I was wondering if there was a way to access espeak as you might in the command line:
say this line first
say this line second
Right now, the only ways I can do it […]
- Python: subprocess call with shell=False not working I am using Python script to invoke a Java virtual machine. The following command works:
subprocess.call(["./rvm"], shell=False) # works
subprocess.call(["./rvm xyz"], shell=True) # […]
- How to hide output of subprocess in Python 2.7 I'm using eSpeak on Ubuntu and have a Python 2.7 script that prints and speaks a message:
text = 'Hello World.'
- Send curl from python I have the following config file in json […]
- Calling os.fsync on the stdout/stderr file descriptors kills a subprocess After spawning a subprocess using the Python subprocess library, I'm using stderr to pass a message from the child process to the parent process containing some serialized data. I then […]
- Python subprocess: callback when cmd exits I'm currently launching a programme using subprocess.Popen(cmd, shell=TRUE)
I'm fairly new to Python, but it 'feels' like there ought to be some api that lets me do something similar […]
- pkill not killing I have a Script named PirateRadio.py That I am writing a script for.
I need to kill and reload the script. Possibly with the same PID. I thought SIGHUP was a sure thing. when i run […]
- Starting a background process in python I'm trying to port a shell script to the much more readable python version. The original shell script starts several processes (utilities, monitors, etc.) in the background with "&". […]