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

ImportError: cannot import name 'Shodan' from 'shodan' #158

Closed
omega71044 opened this issue Aug 10, 2021 · 4 comments
Closed

ImportError: cannot import name 'Shodan' from 'shodan' #158

omega71044 opened this issue Aug 10, 2021 · 4 comments

Comments

@omega71044
Copy link

omega71044 commented Aug 10, 2021

When the following code is executed in visual studio code

from shodan import Shodan
api = Shodan('my-api-key')
ipinfo = api.host('8.8.8.8')
print(ipinfo)

it throws the following error
ImportError: cannot import name 'Shodan' from 'shodan'

Please help

PIP LIST
Package Version


aniso8601 9.0.1
certifi 2021.5.30
charset-normalizer 2.0.4
click 8.0.1
click-plugins 1.1.1
colorama 0.4.4
Flask 2.0.1
Flask-RESTful 0.3.9
idna 3.2
itsdangerous 2.0.1
Jinja2 3.0.1
MarkupSafe 2.0.1
pip 21.2.3
pytz 2021.1
requests 2.26.0
setuptools 41.2.0
shodan 1.25.0
six 1.16.0
urllib3 1.26.6
Werkzeug 2.0.1
XlsxWriter 2.0.0

@sebix
Copy link

sebix commented Aug 10, 2021

Do you have a file in your working directory which is called shodan.py? If yes, rename it to something else, it must not clash with module names

@omega71044
Copy link
Author

omega71044 commented Aug 10, 2021

Thanks it did work. how did you know?

@sebix
Copy link

sebix commented Aug 10, 2021

Because I hacked into your computer ;)

That's a very common error, you'll find lot's of these reports all over the internet, concerning different libraries. Please close the issue if that's now solved, thanks.

@achillean
Copy link
Owner

Thank you for the help @sebix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants