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 'GoogleNews' from partially initialized module 'pygooglenews' #20

Open
wzxtzqrl opened this issue Aug 1, 2021 · 1 comment

Comments

@wzxtzqrl
Copy link

wzxtzqrl commented Aug 1, 2021

Hello, I'm having problem with running pygooglenews.
My error result as follows:

Traceback (most recent call last):

File "C:\pygooglenews.py", line 1, in
from pygooglenews import GoogleNews

ImportError: cannot import name 'GoogleNews' from partially initialized module 'pygooglenews' (most likely due to a circular import) (C:\pygooglenews.py)

Here's my code :

from pygooglenews import GoogleNews
gn = GoogleNews()
search = gn.search('lockdown')
print(search)

@pasenidis
Copy link

Be careful when naming the filenames - Python takes them into account too.

pygooglenews.py has the exact same name with the module you're trying to import the class from. (pygooglenews), this confuses the interpreter, which makes it import GoogleNews from your file.

It is recommended that you rename pygooglenews.py to something like app.py to avoid future problems.

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

2 participants