Hi,

I want to use openbabel to validate a SMILES string. I tried this:

----
#!/usr/bin/env python3
from openbabel import openbabel

mol = openbabel.OBMol()
obConversion = openbabel.OBConversion()
obConversion.SetInFormat('smi')

# case_1: success is True
success = obConversion.ReadString(mol, 'CC((CC')
print('<DBG> success:', success)

# case_2: success is False
success = obConversion.ReadString(mol, 'CC((CCX')
print('<DBG> success:', success)
----

The return value success is True for case_1, False for case_2.
I was expecting success to be False in both cases,
since both do not represent a valid SMILES string.

I assume this is not the correct way to verify a SMILES string?
Is there another way?

Thanks in advance.
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to