I've a python script which takes one command line argument as input from console. Now i want to run the script from a GUI button. The problem is i can't change the code because it's tedious
How can it be done in a easier way? I tried something like this:
subprocess.call(['./myScript.py args'])
but I can't see any output
You should specify command line argument as separated items:
subprocess.call(['./myScript.py', 'args'])
NOTE if your myScript.py
runs long, that could cause UI hang because subprocess.call
wait the process to terminate. Consider using subprocess.Popen
that does not wait the termination.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.