Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log traceback on broken hello.py #31

Open
GoogleCodeExporter opened this issue Dec 16, 2015 · 5 comments
Open

Log traceback on broken hello.py #31

GoogleCodeExporter opened this issue Dec 16, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1.Change hello.py to something "broken" (put some "import PLEASE_BREAK" 
anywhere)
2.The Python code crash
3.You cannot see the traceback

What is the expected output? What do you see instead?

To help debug hello.py, is useful to get the traceback provided by the Python 
interpreter, hopefully at the logcat. There is an logfile saved to the sdcard, 
but it does not contain stdout output, so its not useful.

What version of the product are you using? On what operating system?

Android 2.3.3, 4.0.5 and 4.1

Please provide any additional information below.

I managed to fix this, but had no time to create a proper pull-request yet, but 
I will. Mail me if you're in a hurry and we can talk.

Original issue reported on code.google.com by [email protected] on 26 Jul 2013 at 7:14

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

typo: logfile does not logs "stderr" messages. "stderr" is where the traceback 
goes

Original comment by [email protected] on 26 Jul 2013 at 7:16

@GoogleCodeExporter
Copy link
Author

moderator: please change from "defect" to "feature"

Original comment by [email protected] on 26 Jul 2013 at 7:25

@GoogleCodeExporter
Copy link
Author

Original comment by [email protected] on 29 Jul 2013 at 8:36

  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

@GoogleCodeExporter
Copy link
Author

Seems the log file is flushed only from time to time (maybe StreamGobbler 
issue: http://code.google.com/p/android-python27/issues/detail?id=5 ), in my 
code I do see log there but with delay.

However I'm not using the log created by StreamGobbler, instead I'm using the 
Python logging module and I redirect log entries into my own file.

As for the traceback I'm using the Python traceback module: 
traceback.extract_tb(...

You can also run your script from the cmd line to check what's going on:

export PYTHONHOME=/data/data/com.android.python27/files/python

export 
PYTHONPATH=/sdcard/com.android.python27/extras/python:/data/data/com.android.pyt
hon27/files/python/lib/python2.7/lib-dynload:/data/data/com.android.python27/fil
es/python/lib/python2.7

export PATH=$PYTHONHOME/bin:$PATH

export 
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/data/com.android.python27/files/python/li
b:/data/data/com.android.python27/files/python/lib/python2.7/lib-dynload

export AP_HOST=localhost

export AP_PORT=45777

am start -a com.android.python27.LAUNCH_RPC_SERVER -n 
com.android.python27/.RpcServerLauncher --ei 
com.android.python27.RPC_SERVER_PORT 45777

python my_script.py

Original comment by [email protected] on 29 Jul 2013 at 8:45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant