I am trying to run a python script inside php file, the problem is i can't pass the file as an argument
something like this
$a ="python /umana/frontend/upload/main.py 'filename' ";
$output =shell_exec($a);
The real problem is, the file is not opening in python script.
-
Does this answer your question? Passing value from PHP script to Python scriptRuli– Ruli2021年01月12日 08:10:32 +00:00Commented Jan 12, 2021 at 8:10
-
i want to pass a hex file as a parameter,i can pass the parameter but if i try to open in python its not workingNikhil k gireesh– Nikhil k gireesh2021年01月12日 08:16:18 +00:00Commented Jan 12, 2021 at 8:16
-
append your python code, the problem might be there, is the filename absolute path or relative? If relative, it could be incorrect in main.py locationRuli– Ruli2021年01月12日 08:27:30 +00:00Commented Jan 12, 2021 at 8:27
-
also maybe more of your php code could help, check out how to create a minimal reproducible exampleRuli– Ruli2021年01月12日 08:28:51 +00:00Commented Jan 12, 2021 at 8:28
1 Answer 1
It's solved
$a ="python-path C:/python program path '$file_uploaded_path_as_param' ";
$output =shell_exec($a);
we want to add the python path before python script.
Sign up to request clarification or add additional context in comments.
Comments
default