pygooglenews icon indicating copy to clipboard operation
pygooglenews copied to clipboard

ImportError: cannot import name 'GoogleNews' from partially initialized module 'pygooglenews'

Open wzxtzqrl opened this issue 3 years ago • 1 comments

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)

wzxtzqrl avatar Aug 01 '21 09:08 wzxtzqrl

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.

pasenidis avatar Mar 26 '22 16:03 pasenidis