<div dir="ltr">When executing a python file or command it works<br>but when starting a python shell and interacting with it I'm not getting any output<br><br>1> Port = open_port({spawn, "python -c \"print 1\""}, [binary, exit_status]).<br>
#Port<0.586><br>2> flush().<br>Shell got {#Port<0.586>,{data,<<"1\n">>}}<br>Shell got {#Port<0.586>,{exit_status,0}}<br>ok<br><br><br><div class="gmail_quote">On Mon, Jan 28, 2013 at 1:13 AM, Joseph Wayne Norton <span dir="ltr"><<a href="mailto:norton@lovely.email.ne.jp" target="_blank">norton@lovely.email.ne.jp</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>Here is a snippet that invokes a python program and captures the output.</div>
<div><br></div><div><a href="https://github.com/norton/asciiedoc/blob/master/src/asciiedoc_lib.erl#L96" target="_blank">https://github.com/norton/asciiedoc/blob/master/src/asciiedoc_lib.erl#L96</a></div><div><br></div><div>
This example isn't interactive but might be of help to you.</div><div><br></div><div>regards,</div><div><br></div><div>Joe N.</div><br><div><div><div class="h5"><div>On Jan 28, 2013, at 8:03 AM, pablo platt <<a href="mailto:pablo.platt@gmail.com" target="_blank">pablo.platt@gmail.com</a>> wrote:</div>
<br></div></div><blockquote type="cite"><div><div class="h5"><div dir="ltr">erlport looks interesting but I don't need to manipulate the python shell response.<br>I want to start a python shell (or any other shell), send arbitrary commands to it and get the response.<br>
<br><div class="gmail_quote">
On Mon, Jan 28, 2013 at 12:53 AM, Steve Vinoski <span dir="ltr"><<a href="mailto:vinoski@ieee.org" target="_blank">vinoski@ieee.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br><br><div class="gmail_quote"><div><div>On Sun, Jan 27, 2013 at 4:56 PM, pablo platt <span dir="ltr"><<a href="mailto:pablo.platt@gmail.com" target="_blank">pablo.platt@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">How can I get the output of a python shell?<br><br>This is what I'm trying to do:<br>> Port = open_port({spawn, "python"}, [binary, exit_status]).<br>#Port<0.586><br>> port_command(Port, "print 1\n").<br>
true<br>> flush().<br>ok<br><br>When calling flush(), I expect to get {Port,{data, <<"1\n">>}}<br>but I'm not getting any message.<br></div></blockquote><div><br></div></div></div><div>You might want to try ErlPort:</div>
<div><br></div><div><a href="http://erlport.org/" target="_blank">http://erlport.org</a></div><div><br></div><div>Otherwise, you're just going to have to re-code what ErlPort already gives you.</div><span><font color="#888888"><div>
<br></div><div>--steve</div></font></span></div>
</blockquote></div><br></div></div></div>
_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br><a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br></div></blockquote></div><br></div>