Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SaltBuilder._initPatterns incorrectly handles SMARTS errors #541

Closed
adalke opened this issue Jul 18, 2015 · 0 comments
Closed

SaltBuilder._initPatterns incorrectly handles SMARTS errors #541

adalke opened this issue Jul 18, 2015 · 0 comments
Assignees
Labels
Milestone

Comments

@adalke
Copy link
Contributor

adalke commented Jul 18, 2015

SaltBuilder._initPatterns does the following:

try:
    salt = Chem.MolFromSmarts(splitL[0])
except:
    import traceback
    traceback.print_exc(line)
    raise ValueError(line)

However, MolFromSmarts returns None on error. It doesn't raise an exception. As a result, self.salts gets a None in it, leaving StripMol() to raise a Boost ArgumentError when DeleteSubstructs is passed a None instead of a pattern.

The fix is to replace the above with:

salt = Chem.MolFromSmarts(splitL[0])
if salt is None:
    raise ValueError(line)
@greglandrum greglandrum added the bug label Aug 9, 2015
@greglandrum greglandrum added this to the 2015_09_1 milestone Aug 9, 2015
@greglandrum greglandrum self-assigned this Aug 9, 2015
sriniker pushed a commit to sriniker/rdkit that referenced this issue Oct 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants