Hi All,

I'd appreciate any insight on what I'm doing wrong.  I'm trying to save an
rdSubstructLibrary. with library.toStream().  When library is empty I can
save the library with library.toStream(), however when I've added molecule
to the library, I get this error message.

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe0 in position 121:
invalid continuation byte

Example code below.  Any suggestions would be appreciated.

Thanks,

Pat

#!/usr/bin/env python

import sys
from rdkit import Chem
from rdkit.Chem import rdSubstructLibrary

smiles_list = ["C","CC","CCC","CCCC","CCCCC"]
mol_list = [Chem.MolFromSmiles(x) for x in smiles_list]
library =
rdSubstructLibrary.SubstructLibrary(rdSubstructLibrary.CachedSmilesMolHolder(),

rdSubstructLibrary.PatternHolder())
# Error when molecules are added
# If the two lines below are commented, everything works
for mol in mol_list:
    library.AddMol(mol)
# -----------------------------
with open("out.sslib","w") as f:
    library.ToStream(f)
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to