Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: call python from perl cause error

by syphilis (Canon)
on Aug 09, 2013 at 11:26 UTC ( #1048750=note: print w/ replies, xml ) Need Help??


in reply to call python from perl cause error

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 ;-)

Cheers,
Rob


Comment on Re: call python from perl cause error
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1048750]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (18)
As of 2014-09-02 15:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (25 votes), past polls