As noted by Dr. Landrum, the errors that you are seeing are due to problems in the generation of the original SDF (i.e., improper molecule ending, the atom connectivity, and the use of "Alkyl" as an atom). Generally, RDKit just lets you know that it cannot generate the molecule because of an error in the SDF, and then, instead of producing an RDKit mol object, it produces an instance of
None, which is why the example code in the RDKit docs have the
if mol is None: continue line of code that you included in your example. If you are happy to skip these molecules when you are generating the RDKit fingerprints, you may do so by first removing any molecules that could not be generated and then calculating the fingerprints, as follows:
# import relevant rdkit objects
from rdkit.Chem import RDKFingerprint, SDMolSupplier
# create instance of sdf reader
suppl = SDMolSupplier('1.sdf')
# read all molecules besides ones with errors into a list
mols = [mol for mol in suppl if mol is not None]
# calculate fingerprints
fps = [RDKFingerprint(mol) for mol in mols]
Note that to actually remove the molecules that are throwing errors, you should not read them directly from
SDMolSupplier. As the code is written in your example, it simply will cycle through all of the molecules, see if they are
None (i.e., threw an error while being generated), and then move on - it doesn't actually remove the molecules that are
None, as the sample code I suggested does. Otherwise, you will run into issues when generating the fingerprints, since
RDKFingerprint needs an RDKit mol object to calculate from and will, therefore, throw an error if you try
RDKFingerprint(None) (which is what will happen if you forget to remove the
None objects between reading the SDF and calculating the fingerprints.
If you cannot skip the problematic molecules in the SDF, you should return to the original file and try to repair the errors inside before calculating fingerprints using RDKit. Here is a useful resource that really breaks down what each mol in an SDF contains: https://chem.libretexts.org/Courses/University_of_Arkansas_Little_Rock/ChemInformatics_(2017)%3A_Chem_4399%2F%2F5399/2.2%3A_Chemical_Representations_on_Computer%3A_Part_II/2.2.2%3A_Anatomy_of_a_MOL_file. It has been helpful to me in combing through to correct similar errors.
Hope this helps!