[Biopython] Turning PDBConstructionWarning off

Eric Talevich eric.talevich at gmail.com
Thu Nov 26 20:31:40 UTC 2009


From: Jo?o Rodrigues <anaryin at gmail.com>:
>
> Thanks Rodrigo for the tip. I'd tried to set __debug__ to False as well but
> it didn't work as I wanted (unless I actually edited the module file).
>
> Peter's suggestion is what I wanted. I was completely unaware of the
> "warning" module so I thought it was a BioPython thing.
>
> Thanks!
>
> Jo?o [...] Rodrigues
> @ http://stanford.edu/~joaor/
>

The __debug__ check in Biopython's source code isn't really necessary;
it's set internally by Python. By default it's True, but running
Python with optimizations on (-O on the command line) sets it to False
and automatically skips all warnings. As Peter suggested, the usual
way to hide specific warnings in your applications is with the
warnings module's simplefilter().

Cheers,
Eric



More information about the Biopython mailing list