run a Perl script from Python and stop it when finishes
Question:
I call and run a perl script inside a python script. It calls properly the perl script, works, but it does not stop…it seems that the perl script doesn’t stop.
How can i solve it? if I run manually the perl script alone it stops.
I use…
import subprocess
pipe = subprocess.Popen(["perl", "/home/scripts/cat.pl"])
Answers:
Add the following line to your python program
pipe.wait()
Open your Python code in your Python editor of choice.
Go to the line in the code where you want to run your Perl script.
Type "pyth.RunPerl.ext;" where "Full Path To File" is the full path filename of your Perl file. This will cause Python to execute the Perl file, then continue down the line with the rest of your Python code.
I call and run a perl script inside a python script. It calls properly the perl script, works, but it does not stop…it seems that the perl script doesn’t stop.
How can i solve it? if I run manually the perl script alone it stops.
I use…
import subprocess
pipe = subprocess.Popen(["perl", "/home/scripts/cat.pl"])
Add the following line to your python program
pipe.wait()
Open your Python code in your Python editor of choice.
Go to the line in the code where you want to run your Perl script.
Type "pyth.RunPerl.ext;" where "Full Path To File" is the full path filename of your Perl file. This will cause Python to execute the Perl file, then continue down the line with the rest of your Python code.