0

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 script](https://stackoverflow.com/questions/4977125/passing-value-from-php-script-to-python-script) – Ruli Jan 12 '21 at 08: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 working – Nikhil k gireesh Jan 12 '21 at 08: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 location – Ruli Jan 12 '21 at 08:27
  • also maybe more of your php code could help, check out how to [create a minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) – Ruli Jan 12 '21 at 08:28

1 Answers1

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.