|There's more than one way to do things|
Re: call python from perl cause errorby syphilis (Chancellor)
|on Aug 09, 2013 at 11:26 UTC||Need Help??|
On Windows 7 I can't reproduce the exact problem, but odd things seem to happen with the output when perl calls python.
For example, if, in the python script, I *don't* redirect to NUL then I expect to see the output of the ping command in the console when I execute test.py ... and that happens.
I also expect to be able see the output of the ping command in the console when I run test.pl ... but it doesn't appear. If I change test.pl so that it uses backticks to execute test.py, then I *still* don't see the output of the ping command. But if I change test.pl so that it uses system() to execute test.py, then I *do* see the output of the ping command displayed in the console.
(On the basis if this, I'm wondering whether using system() might improve things for you.)
If I want to use either backticks or qx// to execute test.py, then in order to be able to view the output of the ping command, I have to change it to os.system("ping 127.0.0.1 1>&2")
So, STDOUT is definitely being messed with when perl executes python ... but I don't know the details ... and couldn't find anything readily digestible on the subject on google.
2teez ... if you're wondering ... on Windows the ping command sends just 4 pings and exits, by default ;-)