The documentation for the Python debugger support in mod_python states:
Because pdb is an interactive tool, start httpd from the command line
with the -DONE_PROCESS option when using this directive. As soon as
your
handler code is entered, you will see a Pdb prompt allowing you to
step
through the code and examine variables.
If you enable PythonEnablePdb but try to use Apache in its normal mode,
ie., not as a single foreground process, you will get an error:
Mod_python error: "PythonHandler mptest"
Traceback (most recent call last):
File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/mod_python/apache.py", line 301, in
HandlerDispatch
assert (type(result) == type(int())), \
AssertionError: Handler 'mptest' returned invalid return code.
This occurs because the pdb module internally generates an error when
it somehow realises that it isn't being run in interactive mode. Rather
than this exception being propagated, it simply returns None which
causes the above error.
Even if running pdb in single process mode, if "quit" is entered into
pdb as a command, you will get a similar error.
With the thought of mod_python perhaps ignoring the PythonEnabledPdb
option when not run in single process mode, is there a way using the
apache.mpm_query() function or some other function of determining that
Apache is running in single process mode?
This will not solve the "quit" problem, for that rather than calling
pdb.runcall(), mod_python perhaps could implement an alternate variant
of
the Bdb.runcall() which is ultimately called which raises an appropriate
Apache error more appropriate in context of mod_python when the BdbQuit
exception is raised.
Anyone have any thoughts? Anyone use the "pdb" support?
Graham