I’m trying to run a Python script inside a perl script with the following command:
system("python3 script.py -d http://site.com --no-interaction"); qx/python3 script.py -d http://site.com --no-interaction/;
On the operating system’s command line, the Python script executes, but when I make a call from a PHP application, the perl work, but the python script don’t work.
Advertisement
Answer
Do you get any error message from Perl side? Likely where your PHP/Perl script runs from isn’t the same location as where script.py is at. Try by using full path to Python script. Also double check that python3 is in your $PATH.
For example: -> cat /home/me/python/script.py
print("This line will be printed.")
-> cat /home/me/perl/pytest.pl
#!/bin/env perl print "From perl:n"; system ("python3 /home/me/python/script.py");
cd /home/me/perl/ ksh whence python3 "/usr/bin" pytest.pl "From perl: This line will be printed."