dropping into the debugger on an exception
Thomas Heller
theller at python.net
Wed Jun 9 11:31:15 EDT 2004
Peter Hansen <peter at engcorp.com> writes:
> Jon Perez wrote:
>
>> Thomas Heller wrote:
>>
>>> Is the description in the cookbook unclear? You do *not* have to add
>>> anything to your script - save the code as a file
>>> C:\Python23\sitecustomize.py and everything will work. And you don't
>>> have to start the script from within pdb. The sitecustomize module is
>>> automatically imported when Python starts - if it is found.
>> Yes, I'm aware of this. I don't want to add this to sitecustomize.py
>> because I don't want this happening all the time.
>
> Just to be clear: you don't want this to happen all the time,
> you want it to happen only with a particular script, yet you
> don't want to modify that script at all?
I also don't understand *why* he wants to have it that way.
There's also one (hidden?) feature in the code I posted: The excepthook
only calls the debugger when __debug__ is true, so you can also avoid
the debugger when the python is started with the -O flag.
Thomas
More information about the Python-list
mailing list