Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: call python from perl cause error

by 2teez (Priest)
on Aug 09, 2013 at 08:56 UTC ( #1048714=note: print w/ replies, xml ) Need Help??


in reply to call python from perl cause error

Hi anaconda_wly,
Assuming the python file can not be modified
Then:

  1. You might have to do ... qx/python $mycmd/; in your perl script for it to work.
  2. You will want to use system, instead of backticks and "qx//". Since your python script is redirecting the output of the program into a file named 'NUL'.
    But if what you want is output in your array "@res", then you might have to modify your python script not to 'redirect' using backtick or 'qx//' like you did.
  3. Using your python script on linux OS, since I don't have a Win OS to try it on. Will make the script run almost forever unless the "ping" command in the python script is given a "count" like so: .. "ping -c 10 127.0.0.1 > NUL".

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (17)
As of 2015-07-28 18:44 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 (258 votes), past polls