Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

how to run a python web application from within a perl script

by BhariD (Sexton)
on Nov 19, 2009 at 18:01 UTC ( [id://808221]=perlquestion: print w/replies, xml ) Need Help??

BhariD has asked for the wisdom of the Perl Monks concerning the following question:

I have a perl script which I am using to generate some data. I want to process this data (as an input) through a program that is written using the Webware for Python Web application framework and the Rialto client-side Javascript widget library, to generate the results.

Does anyone know how I can call or run this program from within my perl script. I would appreciate any kind of help or pointers.

Thanks

  • Comment on how to run a python web application from within a perl script

Replies are listed 'Best First'.
Re: how to run a python web application from within a perl script
by BrowserUk (Patriarch) on Nov 19, 2009 at 20:13 UTC

    Use a piped open to feed the data to the python script:

    my @data = genData(); my $pid = open OUT, '-|', 'python theScript.py' or die; print OUT $_ for @data; close OUT; waitpid $pid, 0; ## The python script has finished.

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: how to run a python web application from within a perl script
by Fox (Pilgrim) on Nov 19, 2009 at 18:12 UTC
    run this program from within my perl script
    $output = qx(python path/to/script.py);

      You sort of forgot about the data, didn't you? The op said they were trying to send some data to a python program.

      op, how do those programs read data? From a file?

        op, how do those programs read data? From a file?

        That sounds like a great idea

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://808221]
Approved by Marshall
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-23 18:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found