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
not working #6
Comments
are you using pip for installing the package? |
Could you replace your import with: from newsapi.newsapi_client import NewsApiClient It might be that the namespace is missing from the import statement. |
I'm having the same issue after using pip to install. When I use "from newsapi import NewsApiClient" I get: When I use "from newsapi.newsapi_client import NewsApiClient" i get: |
It looks like you have named your script file "newsapi.py" . Is this correct? If so, it can mix-up the namespace of the import statement. Try updating the filename and see if that resolves the issue. |
Hi, I have the same problem. When I run the .py file, it always says "Import Error: cannot import name NewsApiClient." I want to add this api to google voice kit. |
I cannot seem to replicate this issue. I have attempted a fresh install for both Windows and Mac. If someone would like to upload their project or define their setup (Python version, OS, etc.), I would be happy to assist. For now, I have created a new example project that uses Docker to do a fresh install of Python, pip, and the NewsApi library to retrieve top headlines. I hope this helps. |
my error is caused by my script file name newsapi.py, after i changed the filename, it works normally. @mattlisiv thanks your point |
from newsapi import NewsApiClient newsapi = NewsApiClient(api_key='e6702efb133e48418f78ea26f4620e20') top_headlines = newsapi.get_top_headlines(q='bitcoin', sources='bbc-news,the-verge', category='business', language='en', country='us')
getting error in python3.x
ImportError: cannot import name 'NewsApiClient'
The text was updated successfully, but these errors were encountered: