pygooglenews
pygooglenews copied to clipboard
Package Errors
Hey yall, I properly imported the packages, but for some reason I keep getting the following errors. Any suggestions?
Im running the following code:
from pygooglenews import GoogleNews
import json
import time
gn = GoogleNews()
top = gn.top_news()
entries = top["entries"]
count = 0
for entry in entries:
count = count + 1
print(
str(count) + ". " + entry["title"] + entry["published"]
)
time.sleep(0.25)
I just installed the feedparser
package (pip3 install feedparser --upgrade
) and it worked, but it gave the following message after installation:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behavior is the source of the following dependency conflicts. pygooglenews 0.1.2 requires feedparser<6.0.0,>=5.2.1, but you have feedparser 6.0.10 which is incompatible.
So use your discretion, pygooglenews
works after that anyway
I attempted the following steps and succeeded.
- install specified version of setuptools
pip install setuptools==57.5.0
- install pygooglenews
pip install pygooglenews
I am using Poetry as my Environment manager, so when I do this..
(news-test-project-py3.11) PS C:\Users\rezam\codespace\news-test-project> poetry add pygooglenews
Using version ^0.1.2 for pygooglenews
Updating dependencies
Resolving dependencies...
Writing lock file
Package operations: 9 installs, 0 updates, 0 removals
• Installing tzdata (2023.3)
• Installing pytz (2023.3.post1)
• Installing regex (2023.10.3)
• Installing soupsieve (2.5)
• Installing tzlocal (5.1)
• Installing beautifulsoup4 (4.12.2)
• Installing dateparser (0.7.6)
• Installing feedparser (5.2.1)
ChefBuildError
Backend subprocess exited when trying to invoke get_requires_for_build_wheel
error in feedparser setup command: use_2to3 is invalid.
at ~\.local\pipx\venvs\poetry\Lib\site-packages\poetry\installation\chef.py:152 in _prepare
148│
149│ error = ChefBuildError("\n\n".join(message_parts))
150│
151│ if error is not None:
→ 152│ raise error from None
153│
154│ return path
155│
156│ def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:
Note: This error originates from the build backend, and is likely not a problem with poetry but with feedparser (5.2.1) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "feedparser (==5.2.1)"'.
Finally I tried @JackDance 's solution and that works. But it would be nice to have the updated version of setuptools
and feedparser