Show errors when you run a Python script from php with system, in a shared hosting

0

I'm running a Python script from php like this,

  

$ mystring = system ('python test.py', $ retval);

and it works, only that I would like to be able to see the errors of the Python script. It's possible? The "print" of Python for example are seen, but the Python script errors are not, it is clearly failing to import a module because the execution stops there and does not show any error on the screen

    
asked by Pablo 04.08.2016 в 15:43
source

1 answer

1

Try the following:

$mystring = system("python test.py 2>&1", $retval);

If it does not work for you, please indicate the OS.

Although the ideal would be that you first debug the Python script from your terminal and once it works and you know the dependencies, python version, ..., go to the shared hosting, install the dependencies and upload the script ...

    
answered by 04.08.2016 / 16:49
source