Skip to content

get_compounds fails when given multiple smiles #150

@simanjo

Description

@simanjo

When trying to get compounds by smiles, the server responds with an error, when giving the identifiers as list:

\>\>\> pubchempy.get_compounds(['C', 'O'], 'smiles')
Traceback (most recent call last):
[...]
urllib.error.HTTPError: HTTP Error 400: PUGREST.BadRequest

The above exception was the direct cause of the following exception:
[...]
pubchempy.BadRequestError: PubChem HTTP Error 400 PUGREST.BadRequest: Unable to standardize the given structure - perhaps some special 
characters need to be escaped or data packed in a MIME form? (error: , status: 400, output: Caught ncbi::CException: Standardization 
failed, Output Log:, Record 1: Warning: Cactvs Ensemble cannot be created from input string, 
Record 1: Error: Unable to convert input into a compound object, , )`

I omitted the trace, bc I believe this is not supported by pubchem to start with according to the documentation:

<identifiers> = comma-separated list of positive integers (e.g. cid, sid, aid) or identifier strings (source, inchikey, formula); in some cases only a single identifier string (name, smiles, xref; inchi, sdf by POST only)

This similarly happens with just a single smiles in a list.
When trying with names in a list, the result is empty, so I figure pubchem interprets the comma-seperated list as single name.

I'm happy to provide more details on setup and the like, if necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions