[Python] Cannot convert '<!-' to unsigned int

Discussão em 'Python' iniciado por Stack, Novembro 27, 2024.

  1. Stack

    Stack Membro Participativo

    I'm trying to print the number of atoms in a molecule with rdkit, but i keep running into this problem even though the code is roughly the same as the tutorial i was following:

    [17:11:25] Cannot convert '<!-' to unsigned int on line 4
    Traceback (most recent call last):
    File "c:\Users\frede\OneDrive\Skrivebord\Projekter\Python\Kemi\main.py", line 9, in <module>
    text = morphine.GetNumAtoms()
    ^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'NoneType' object has no attribute 'GetNumAtoms'


    I'm running python in VSCode, using rdkit which i installed directly with pip (I don't have anaconda installed).

    Here is the code i wrote:

    from rdkit import Chem
    import requests

    morphine_url = 'https://go.drugbank.com/structures/small_molecule_drugs/DB00295.mol'
    morphine_mol = requests.get(morphine_url).text

    morphine = Chem.MolFromMolBlock(morphine_mol)

    text = morphine.GetNumAtoms()

    print(text)


    What confuses me the most is the "Cannot convert '<!-' to unsigned int on line 4" part, as i can't find any information as to what '<!-' actually means.

    Continue reading...

Compartilhe esta Página