Hi all,

I'd like to capture error messages during SMILES parsing, but am having
trouble getting this to work.

The following code raises an AssertionError, for example. Is there
something here I'm missing? I'm using this from a Windows 7 conda
environment, Python 2.7 64-bit, RDKit 2017.03.3, but a similar conda
environment is also failing for me on Linux.

import sys
from rdkit import Chem
from StringIO import StringIO

old_stderr = sys.stderr
sio = sys.stderr = StringIO()

mol = Chem.MolFromSmiles("c1ccccc")
sys.stderr = old_stderr

assert sio.read() != ""

- Noel
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Rdkit-discuss mailing list

Reply via email to