Editing PyMaemo/HildonDesktop
Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 163: | Line 163: | ||
</pre> | </pre> | ||
- | + | Another way of debugging python widgets is to add this code at the begining of the script: | |
- | + | <pre> | |
- | Another way of debugging python widgets is to add this code at the | + | |
- | < | + | |
import sys | import sys | ||
f=open('/tmp/mylog.log', 'at', buffering=1) | f=open('/tmp/mylog.log', 'at', buffering=1) | ||
sys.stdout=f | sys.stdout=f | ||
sys.stderr=f | sys.stderr=f | ||
- | </ | + | </pre> |
- | This will redirect stdout and stderr to | + | This will redirect stdout and stderr to /tmp/mylog.log. This means that all exceptions and all other output will be logged there. As a plus, the code can be given to testers and they'll be able to report-back with the contents of the logfile. |
- | However, ' | + | However, DON'T use this by default in production systems. Use it ONLY for debugging since the file will consume space in /tmp and will only grow in size. |
[[Category:Python]] | [[Category:Python]] |
Learn more about Contributing to the wiki.