I have the following python script test.py:
import subprocess
subprocess.call(["php", "C:/Documents and Settings/user/My Documents/Downloads/load_data.php"])
the idea is to run another php script in which I make a LOAD DATA INFILE to a MySQL table, but it generates the following error:
Traceback <most recent call last>:
File "test.py", line 3, in <module>
subprocess.call<["php","load_data.php"]>
File "C:\Python34\lib\subprocess.py", line 537, in call
with Popen<*popenargs, **kwargs> as p:
File "C:\Python34\lib\subprocess.py" line 859, in __init__
restore_signals, start_new_session>
File "C:\Python34\lib\subprocess.py", line 1114, in _execute_child startupinfo>
FileNotFoundError: [WinError 2] The system cannot find the file specified
If I run the direct load_data.php script in a web browser, it works without any problem so it seems to me that the problem is in python, it is worth mentioning that I have done this correctly before but with python 3.6, some idea if I need it configure something or add a library.
I have php5.3, apache 2.2.21, mysql5.5.20, python3.4, I tried to put the absolute path of the PHP script but is the same
Regards!
subprocess()doesn't call out to the shell, it directly invokes the executable. Therefore it likely isn't searching the PATH for matching executables.curl yourdomain/yourphppath.phpis better choise