[chimera-dev] About debugging in chimera
Eric Pettersen
pett at cgl.ucsf.edu
Mon Jan 13 11:30:26 PST 2020
Hi Shuangbo,
Chimera redirects normal standout output and standard error to the Reply Log, so that normal print statements will go there. Therefore, the prompt of the pdb.set_trace() convenience function is probably showing up in the Log and not your shell. You need to use the actual Pdb class so that you can get the prompt to go to the original standard output rather than the redirected one. So namely:
from pdb import Pdb
import sys
debugger = Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__)
debugger.set_trace()
—Eric
Eric Pettersen
UCSF Computer Graphics Lab
> On Jan 12, 2020, at 9:31 PM, 张双博 <2088zsp at gmail.com> wrote:
>
>
> Dear Sir/Madam,
>
> I am trying to debug one of the existing plugins to help my understanding of how to write my extension. Usually, I would place "import pdb; pdb.set_trace()" in some lines of the program where I am interested and run it. And when the program encounters this line, it will stop, so I can go through line by line to follow the logic of this python program, which is really helpful. However, when I did this to one plugin of chimera, the plugin and chimera seems frozen, I mean, both didn't respond and there is no "(Pdb)" prompt in opening shell as normally did. I tried this in different places in different scripts, none worked. So I would like to ask how to enable this feature in Chimera or are there some other ways for debugging in Chimera?
>
> Sincerely,
>
> Shuangbo
> _______________________________________________
> Chimera-dev mailing list
> Chimera-dev at cgl.ucsf.edu
> http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20200113/adcf376c/attachment.html>
More information about the Chimera-dev
mailing list