I am using Pybel - a Python wrapper around the OpenBabel API, and I am trying to disable warnings such as these:
==============================
*** Open Babel Warning in ParseComplex
Illegal aromatic element b-
My warnings were raised consistently when fingerprinting molecule SMILES fetched from ChEMBL
You can obtain a handle to the openbabel logger (the class
OBMessageHandler) off of theopenbabelmodule. The trick is to first access the openbabel module off of the pybel module, grab theOBMessageHandlerclass, and instantiate the logger (docs):Using the handle, you can set the
log_levelto 0 to disable all but critical messages (docs):You can use the following enumerations (docs here) to choose your level of logging. The default is 1, which logs all warnings: