pyro.699 has asked for the wisdom of the Perl Monks concerning the following question:

Hello, i am just looking to see if there was a way that i can run a python script from the perl command line? Its a file that will generate alot of information and then just put it into a text file, so it just needs to be run and no information will be taken directly from it. Is there any way to accomplish this? Thanks

Replies are listed 'Best First'.
Re: Run Python Scripts
by Old_Gray_Bear (Bishop) on Apr 28, 2007 at 00:53 UTC
    I am not exactly sure what you mean by "the perl command line". The Command Line in UNIX is language agnostic, pretty much.

    If what you want it to run a Python script from within a Perl script, then something like this should work:

    #! /usr/local/bin/perl use strict; use warnings; my $rc = qx(/usr/local/bin/python MyPythonCode.py); ########## # Do Stuff with the data in $rc ########## exit(0);
    I think. My Python talents extend pretty much as far a 'Hello World'.

    ----
    I Go Back to Sleep, Now.

    OGB

Re: Run Python Scripts
by renodino (Curate) on Apr 27, 2007 at 23:58 UTC
      No, this did not work ^^ i could not find the inline perl module, i found many others though
Re: Run Python Scripts
by swampyankee (Parson) on Apr 28, 2007 at 03:48 UTC

    Umnh, use Python to run Python?

    Or, from within a Perl program, one could use the system command or backticks.

    emc

    Insisting on perfect safety is for people who don't have the balls to live in the real world.

    —Mary Shafer, NASA Dryden Flight Research Center