Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 lurking in the Monastery: (5)
As of 2015-07-06 05:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls