Hi Jean-Marc,

Just a thought, but SDMolSupplier has a lazy eval, if I am not mistaken. 
Technically you should get all the rdkit warnings and errors at the time of 
processing that bit of the sdf file. You can always read the stderror output, 
parse it and throw exception every time a 'funny' molecule comes in.

I use a routine similar to this:

from io import StringIO
import sys
import rdkit

saved_std_err = sys.stderr
log = sys.stderr = StringIO()
rdkit.Chem.WrapLogs()

reader = Chem.SDMolSupplier('my_file.sdf')
       for mol in reader:       
        error_msgs = log.getvalue()
    
        # check error_msgs content if it there are any particular errors and 
act accordingly, erhaps even flush the stream
    
sys.stderr = saved_std_err

Lukas

On 21/01/2019, 13:24, "Jean-Marc Nuzillard" <jm.nuzill...@univ-reims.fr> wrote:

    Chem.SDMolSupplier




_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to