Skip to content
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

[Bug]: help me understand use of pyKVFinder #61

Closed
pippo1990 opened this issue Sep 22, 2023 · 5 comments · Fixed by #62
Closed

[Bug]: help me understand use of pyKVFinder #61

pippo1990 opened this issue Sep 22, 2023 · 5 comments · Fixed by #62
Assignees
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@pippo1990
Copy link

pippo1990 commented Sep 22, 2023

Bug summary

In pyKVFinder/pyKVFinder/main.py I have as an example of how to run it:

>>> import os
>>> import pyKVFinder
>>> pdb = os.path.join(os.path.dirname(pyKVFinder.__file__), 'data', 'tests', '1FMO.pdb')
>>> results = pyKVFinder.run_workflow(pdb)
>>> results..... (result.export() , results.results.cavities etc etc )

and this works fine with me; but then I have multiple instances of :

>>> from pyKVFinder import pyKVFinder
>>> import os
>>> pdb = os.path.join(os.path.dirname(pyKVFinder.__file__), 'data', 'tests', '1FMO.pdb')
>>> results = pyKVFinder(pdb)
>>> results.export()

and this fails to me with : ImportError: cannot import name 'pyKVFinder' from 'pyKVFinder'

what am I doing wrong ?

Code for reproduction

>>> from pyKVFinder import pyKVFinder
>>> import os
>>> pdb = os.path.join(os.path.dirname(pyKVFinder.__file__), 'data', 'tests', '1FMO.pdb')
>>> results = pyKVFinder(pdb)
>>> results.export()

Actual outcome

ImportError: cannot import name 'pyKVFinder' from 'pyKVFinder'

Expected outcome

run flawless like with:

>>> import os
 >>> import pyKVFinder
 >>> pdb = os.path.join(os.path.dirname(pyKVFinder.__file__), 'data', 'tests', '1FMO.pdb')
 >>> results = pyKVFinder.run_workflow(pdb)
 >>> results

Additional information

No response

Operating system

No response

Python version

No response

pyKVFinder Version

0.6.1

Numpy Version

No response

Jupyter version

No response

Installation

pip

@jvsguerra jvsguerra self-assigned this Sep 22, 2023
@jvsguerra jvsguerra added the good first issue Good for newcomers label Sep 22, 2023
@jvsguerra
Copy link
Member

jvsguerra commented Sep 22, 2023

Hi @pippo1990,

It seems like you're encountering an ImportError because you're trying to import the pyKVFinder module incorrectly. To run the cavity detection workflow, you should import it as follows:

from pyKVFinder import run_workflow

The pyKVFinder module itself doesn't exist, which is why you're getting the ImportError.

Once you've imported run_workflow correctly, you can use it in your code as shown below:

import os
import pyKVFinder
from pyKVFinder import run_workflow

pdb = os.path.join(os.path.dirname(pyKVFinder.__file__), 'data', 'tests', '1FMO.pdb')
results = run_workflow(pdb)
results.export()

This should allow you to run the cavity detection workflow without any issues.

For more detailed information on how to use pyKVFinder and its features, please refer to the official tutorial: pyKVFinder Tutorial.

If you encounter any further issues or have additional questions, please feel free to ask for assistance.

@pippo1990
Copy link
Author

pippo1990 commented Sep 23, 2023

Hi @jvsguerra , this is what I expected, the :

>>> from pyKVFinder import pyKVFinder
>>> import os
>>> pdb = os.path.join(os.path.dirname(pyKVFinder.__file__), 'data', 'tests', '1FMO.pdb')
>>> results = pyKVFinder(pdb)
>>> results.export()

is in your main.py code :

>>> from pyKVFinder import pyKVFinder

>>> from pyKVFinder import pyKVFinder

>>> from pyKVFinder import pyKVFinder

>>> from pyKVFinder import pyKVFinder

I dont know how to issue a pull request though, just to let you Know that your documentation contain bugs

Cheers P.

@jvsguerra jvsguerra added the documentation Improvements or additions to documentation label Sep 23, 2023
@jvsguerra
Copy link
Member

jvsguerra commented Sep 23, 2023

Thank you, @pippo1990, for bringing this to my attention.

I appreciate your willingness to contribute to improving the documentation. These outdated code snippets can indeed be confusing for users, so it's crucial to keep our documentation accurate and up to date.

No worries. I've opened and merged PR #62 to address these inconsistencies.

If you encounter any further issues or have additional questions, please feel free to ask for assistance.

@jvsguerra jvsguerra linked a pull request Sep 23, 2023 that will close this issue
@pippo1990
Copy link
Author

👍

@jvsguerra
Copy link
Member

jvsguerra commented Sep 25, 2023

@pippo1990, I am closing this issue for now.
If you feel that the issue is still relevant or have any further questions, please feel free to re-open it and provide any additional information that may be helpful in resolving the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants