-
Notifications
You must be signed in to change notification settings - Fork 69
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
AttributeError: 'NoneType' object has no attribute 'GetAtoms' #9
Comments
Most likely an error when RDKit is trying to read the SMILES string. If RDKit encounters en error trying to turn the SMILES into its internal Mol object, it just returns None, which is why the error says 'NoneType' instead of RDKits internal Mol object. Check the SMILES string that you're trying to load and make sure it's correct. |
Thank you so much for responding! |
Do you mind sharing what SMILES you're trying?
…On Tue, Oct 15, 2019 at 12:43 PM Karunakar444 ***@***.***> wrote:
Thank you so much for responding!
I tried with different smiles but I am still getting the error!
I have even tried with very simple smiles but of no use.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#9?email_source=notifications&email_token=ABAEXJTKXFQXO5KDEW3EYALQOXXMLA5CNFSM4JA2ZL7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBJOKBI#issuecomment-542303493>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABAEXJSXYPC7KJTARZCXMSTQOXXMLANCNFSM4JA2ZL7A>
.
|
First I tried with what u have provided and then I have used the following: |
You have an unclosed ring according to RDKit. You can check it like this from an interactive python shell
Note that I only included a part of the SMILES string that you provided, because this is the particular part where the error is occurring. I think the error is not that your ring isn't closed, but rather you may be missing some double bonds and/or explicit hydrogens. |
could you make an exception line of code? Iwhen trying to manage 3000 compounds, I tried variations on I if 'NoneType' : continue but none of them worked up to now............ |
I just found it inserting this line of code before the function: if not mol: continue |
Could you please elaborate how you did this? I have the same problem with .GetRingInfo() because if I use mol, it just tells me the variable is not defined |
You should use |
This worked as well.
|
I am also getting same error. But, I am trying to read rdf file. Here is the code that I am using: Please help me on resolving this error. |
try this from chatgpt:
from rdkit import Chem
# Try to read the RDF file
try:
suppl = Chem.SDMolSupplier('CAS_sample.rdf')
if not suppl:
raise ValueError("SDMolSupplier failed to read the file. Check if
the file path is correct and the file is accessible.")
for mol in suppl:
if mol is None:
print("Error reading a molecule from the RDF file.")
else:
print(mol.GetNumAtoms())
except Exception as e:
print(f"An error occurred: {e}")
Le mar. 2 juil. 2024 à 07:45, RitikaKabra ***@***.***> a
écrit :
… I am also getting same error. But, I am trying to read rdf file.
Here is the code that I am using:
suppl = Chem.SDMolSupplier('CAS_sample.rdf') for mol in suppl:
print(mol.GetNumAtoms())
Please help me on resolving this error.
—
Reply to this email directly, view it on GitHub
<#9 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJIN3FBHQKWYJJ6XLIILNNDZKJEB5AVCNFSM6AAAAABKG4D422VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBSGA3TONRQGA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I Tried your code, its giving me following error: [14:21:54] ERROR: Counts line too short: '$RXN' on line4 |
Hello!
I have the following error while executing the code. Please help me with this.
The text was updated successfully, but these errors were encountered: