[Rdkit-devel] Python vs C++ exceptions
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: <gi...@gm...> - 2010-12-13 14:51:27
|
While reading some SD molecules in python, I've got on the console
messages like:
[15:18:47] Explicit valence for atom # 0 N, 4, is greater than permitted
[15:18:47] ERROR: Could not sanitize molecule ending on line 48
[15:18:47] ERROR: Explicit valence for atom # 0 N, 4, is greater than permitted
Then my script breaks (rightfully) when accessing the structure which
is not loaded
Traceback (most recent call last):
File "importdata.py", line 23, in <module>
molecule = Chem.MolToSmiles(sup[0])
Boost.Python.ArgumentError: Python argument types in
rdkit.Chem.rdmolfiles.MolToSmiles(NoneType)
did not match C++ signature:
MolToSmiles(RDKit::ROMol {lvalue} mol, bool isomericSmiles=False,
bool kekuleSmiles=False, int rootedAtAtom=-1)
I've checked the C++ code and it seems the error comes from the
calcExplicitValence() method in Code/GraphMol/Atom.cpp
Now my question is: since the method throws MolSanitizeException(msg);
maybe there should be a way from python to catch it?
--
Gianluca Sforna
http://morefedora.blogspot.com
http://identi.ca/giallu - http://twitter.com/giallu
|