a-r-j / graphein

Protein Graph Library
https://graphein.ai/
MIT License
998 stars 125 forks source link

NameError for missing `os` import in `graphein.protein.graphs` #296

Closed kamurani closed 1 year ago

kamurani commented 1 year ago

When using the construct_graph function in a jupyter notebook, I encountered this error:

File ~/env/python3.10/site-packages/graphein/protein/graphs.py:764, in construct_graph(config, name, pdb_path, uniprot_id, pdb_code, df, chain_selection, model_index, df_processing_funcs, edge_construction_funcs, edge_annotation_funcs, node_annotation_funcs, graph_annotation_funcs, verbose)
    761 if pdb_path is not None and isinstance(pdb_path, Path):
    762     pdb_path = os.fsdecode(pdb_path)
...
--> 764 # If no config is provided, use default
    765 if config is None:
    766     config = ProteinGraphConfig()

NameError: name 'os' is not defined

In the graphs.py file, there is no import os. Adding this fixes the error. Not sure what's going on as I've never encountered this before?

a-r-j commented 1 year ago

Thanks for the bug report. No idea how this slipped through testing. I'll make a new release ASAP.

a-r-j commented 1 year ago

Should be resolved in 1.7.0 (pip install graphein==1.7.0)