GithubHelp home page GithubHelp logo

not working about newsapi-python HOT 8 CLOSED

mattlisiv avatar mattlisiv commented on August 25, 2024
not working

from newsapi-python.

Comments (8)

mattlisiv avatar mattlisiv commented on August 25, 2024 6

Could you replace your import with:

from newsapi.newsapi_client import NewsApiClient

It might be that the namespace is missing from the import statement.

from newsapi-python.

mattlisiv avatar mattlisiv commented on August 25, 2024 4

@heedro,

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.

from newsapi-python.

mattlisiv avatar mattlisiv commented on August 25, 2024

@dangerrockstar,

are you using pip for installing the package?

from newsapi-python.

dangerrockstar avatar dangerrockstar commented on August 25, 2024

yeah its add in my pip list but not working
untitled

from newsapi-python.

heedro avatar heedro commented on August 25, 2024

I'm having the same issue after using pip to install.

When I use "from newsapi import NewsApiClient" I get:
Traceback (most recent call last):
File "newsapi.org\newsapi.py", line 7, in
from newsapi import NewsApiClient
File "newsapi.org\newsapi.py", line 7, in
from newsapi import NewsApiClient
ImportError: cannot import name 'NewsApiClient'

When I use "from newsapi.newsapi_client import NewsApiClient" i get:
Traceback (most recent call last):
File "newsapi.org\newsapi.py", line 7, in
from newsapi.newsapi_client import NewsApiClient
File "newsapi.org\newsapi.py", line 7, in
from newsapi.newsapi_client import NewsApiClient
ImportError: No module named 'newsapi.newsapi_client'; 'newsapi' is not a package

from newsapi-python.

reneewxy avatar reneewxy commented on August 25, 2024

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.

from newsapi-python.

mattlisiv avatar mattlisiv commented on August 25, 2024

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.

https://github.com/mattlisiv/newsapi-docker

from newsapi-python.

xidongsheng avatar xidongsheng commented on August 25, 2024

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-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.