Hi Matt, a bug report for something I've noticed in the latest release.
The standardize_smiles, Standardizer().tautomer_parent and Standardizer().standardize functions all fail because of line 133. These all work okay in 0.0.9
>>> mol = Chem.MolFromSmiles('[Na]OC(=O)c1ccc(C[S+2]([O-])([O-]))cc1')
>>> Standardizer().standardize(mol)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/travis/anaconda3/envs/rdkit/lib/python3.6/site-packages/molvs/standardize.py", line 98, in standardize
mol = self.normalize(mol)
File "/home/travis/anaconda3/envs/rdkit/lib/python3.6/site-packages/molvs/normalize.py", line 105, in __call__
return self.normalize(mol)
File "/home/travis/anaconda3/envs/rdkit/lib/python3.6/site-packages/molvs/normalize.py", line 124, in normalize
fragments.append(self._normalize_fragment(fragment))
File "/home/travis/anaconda3/envs/rdkit/lib/python3.6/site-packages/molvs/normalize.py", line 133, in _normalize_fragment
for n in six.moves.range(self.max_restarts):
NameError: name 'six' is not defined
I had a look at the file and it seems that the 'import six' line is missing. When this is added, I get another error, but I think this may be a Py2 vs Py3 difference:
>>> Standardizer().standardize(mol)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/travis/anaconda3/envs/rdkit/lib/python3.6/site-packages/molvs/standardize.py", line 98, in standardize
mol = self.normalize(mol)
File "/home/travis/anaconda3/envs/rdkit/lib/python3.6/site-packages/molvs/normalize.py", line 106, in __call__
return self.normalize(mol)
File "/home/travis/anaconda3/envs/rdkit/lib/python3.6/site-packages/molvs/normalize.py", line 125, in normalize
fragments.append(self._normalize_fragment(fragment))
File "/home/travis/anaconda3/envs/rdkit/lib/python3.6/site-packages/molvs/normalize.py", line 137, in _normalize_fragment
product = self._apply_transform(mol, normalization.transform)
File "/home/travis/anaconda3/envs/rdkit/lib/python3.6/site-packages/molvs/utils.py", line 28, in fget_memoized
setattr(self, attr_name, fget(self))
File "/home/travis/anaconda3/envs/rdkit/lib/python3.6/site-packages/molvs/normalize.py", line 42, in transform
return AllChem.ReactionFromSmarts(self.transform_str.encode('utf8'))
Boost.Python.ArgumentError: Python argument types in
rdkit.Chem.rdChemReactions.ReactionFromSmarts(bytes)
did not match C++ signature:
ReactionFromSmarts(char const* SMARTS, boost::python::dict replacements={}, bool useSmiles=False)
When I move ".encode('utf8')" from line 42 it works as expected in Py3, but I think this would probably produce an error on Py2.
EDIT: I see that these changes are already reflected in the file on GitHub, it seems that the PyPI version is just a bit out of date