zionhigt / android-python27

Automatically exported from code.google.com/p/android-python27
0 stars 0 forks source link

How to retrieve errors? #24

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This is a really interesting project, but I'm wondering how to get more out of 
it than just
interpreting some basic code.

How do I manually run code and get the standard output from the Python process?

Original issue reported on code.google.com by overv161@gmail.com on 26 Mar 2013 at 9:09

GoogleCodeExporter commented 8 years ago
See 
http://code.google.com/p/android-python27/wiki/TutorialHowToRunPythonfromShell

Original comment by anthony....@gmail.com on 26 Mar 2013 at 9:10

GoogleCodeExporter commented 8 years ago
Sorry, I meant how to do it from an APK. Say, I have some library written in 
Python that takes input and produces output I want to display in my app, how 
would I approach that?

Original comment by overv161@gmail.com on 26 Mar 2013 at 9:11

GoogleCodeExporter commented 8 years ago
If possible, it would be even better if the process could be running for a 
while and accept input at any time. That's because the library takes some time 
to start up.

Original comment by overv161@gmail.com on 26 Mar 2013 at 9:13

GoogleCodeExporter commented 8 years ago
Do you have example ?

Would smth like that fit ?

p = Popen(your_cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
(stdout, stderr) = p.communicate()

Original comment by anthony....@gmail.com on 26 Mar 2013 at 9:17