Hongtian schrieb:
Hi Friends,

My application is written in C/C++ and Python is embed to extend some
functions (several .py files are invoked). But I am confused how to
debug these embed Python? Can I use 'print-debuging'? and where can I
capture the output string?

Or Python can support 'break' debug for such scenario?

You should be able to use the python debugger (pdb) by manually putting

import pdb; pdb.set_trace()

on a place that is of interest to you. Then if your program is started inside a shell, you should be able to step-debug it.

Additinoally, there is the very flexible & powerful logging-module that you can use to write logfiles. This is better than simple print-statements, as you can keep the logging statements around and just turn them on or off on demand.

Additionally, printing might not work reliably in cases where the stdout/err-streams aren't visible or otherwise in use. But the logging-module can log to files (or even system event logs *me thinks*)

Diez
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to