Re: Inline::Python Python child process stdout redirection

[email protected] (Stefan Seifert)
Newsgroups perl.inline
Message-ID <1599396.tsI0OhiR4X@sphinx>
On Monday 18 March 2013 21:10:24 Chris Nighswonger wrote:

> I'm using Inline::Python to call a Python function which writes to stdout.
> I'm guessing that Inline::Python forks at some point to run Python.

No, Inline::Python uses an embedded Python interpreter to run Python code.

> Is
> there a way to redirect the stdout of the resulting child process?

It's the same stdout, you use in Perl. You can redirect it just in the same 
way:

use Inline Python => <<PYTHON;
def test():
    print "hello"
PYTHON
open STDOUT, ">/tmp/stdout";
test();

Regards,
Stefan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.