pygooglenews icon indicating copy to clipboard operation
pygooglenews copied to clipboard

base 64 deprecation

Open NilaiVemula opened this issue 4 years ago • 10 comments

This package depends on feedparser, which has an error in this section of feedparser.py (line 91):

# Python 3.1 deprecates decodestring in favor of decodebytes
_base64decode = getattr(base64, 'decodebytes', base64.decodestring)

This has been deprecated since Python 3.1, but it was completely removed in Python 3.9. This makes it unable to import.

NilaiVemula avatar Dec 06 '20 23:12 NilaiVemula

This has been fixed in feedparser : https://github.com/kurtmckee/feedparser/pull/206

tirkarthi avatar Dec 07 '20 12:12 tirkarthi

This has been fixed in feedparser : kurtmckee/feedparser#206

Indeed, but my pygooglenews forces me to use the old version of feedparser, it won't start with the new one and the old one gives me the depreciated issue. Looking for a fix

pygooglenews 0.1.2 requires feedparser<6.0.0,>=5.2.1, but you have feedparser 6.0.8 which is incompatible.

File "---", line 4, in <module>
    from pygooglenews import GoogleNews
  File "---", line 1, in <module>
    import feedparser
  File "---", line 93, in <module>
    _base64decode = getattr(base64, 'decodebytes', base64.decodestring)
AttributeError: module 'base64' has no attribute 'decodestring'

Pyth3rEx avatar Aug 15 '21 13:08 Pyth3rEx

You need to update feedparser:

pip install -U --no-deps "feedparser>=6.0.8"

Side note: dateparser is also outdated, so I recommend updating it as well:

pip install -U --no-deps "dateparser>=1.0.0"

Alyetama avatar Aug 20 '21 13:08 Alyetama

Using this technique allowed me to install the latest feedparser indeed, but my enviroment dosn't seem to reconise it as I get the following error. I am unsure as to why this is happening as it shows up correctl in 'pip list' ModuleNotFoundError: No module named 'feedparser'

Pyth3rEx avatar Aug 20 '21 15:08 Pyth3rEx

Using this technique allowed me to install the latest feedparser indeed, but my enviroment dosn't seem to reconise it as I get the following error. I am unsure as to why this is happening as it shows up correctl in 'pip list' ModuleNotFoundError: No module named 'feedparser'

Can you post the full error traceback and the output of:

$ which pip
$ pip show feedparser

Alyetama avatar Aug 20 '21 16:08 Alyetama

(base) C:\Users\Pyth3rEx>which pip
'which' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.

(base) C:\Users\Pyth3rEx>pip show feedparser
Name: feedparser
Version: 6.0.8
Summary: Universal feed parser, handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds
Home-page: https://github.com/kurtmckee/feedparser
Author: Kurt McKee
Author-email: [email protected]
License: BSD-2-Clause
Location: c:\users\pyth3rex\anaconda3\lib\site-packages
Requires: sgmllib3k
Required-by: pygooglenews

Notice that the first issue means that 'which' is not reconised as a command.

Pyth3rEx avatar Aug 21 '21 05:08 Pyth3rEx

which is a unix command, so that's normal since you're on windows. I suspect that you are running the program on a different python installation than the one in your anaconda environment. To check if this is the case, open Anaconda with the Start Menu and select Anaconda Prompt, type python and press Enter. Then try importing the package from there import feedparser.

Are you using PyCharm, VS Code, or Sublime Text, etc.? If you are, then find out how to set your Anaconda Python installation as your interpreter (or "build" if you use sublime text).

Alyetama avatar Aug 21 '21 12:08 Alyetama

Feedparsr is correctly installed (due to the pip show command) but when importing gets me the error No module named 'feedparser'

Pyth3rEx avatar Aug 29 '21 09:08 Pyth3rEx

Found a temporary fix: py -3.8 <file.py> Not that I use the -3.8 parameter since I have it installed, but for people reading this to find a fix, just use any version you have intalled (eg. -3.6; -2.6... or whatever) Also note that the py command comes packed with python 3.5 and above, for other versions you'll have to get pylauncher for yourself.

Pyth3rEx avatar Aug 29 '21 10:08 Pyth3rEx

Try this, it just worked for me now:

!pip install "setuptools<58" !pip install -U --no-deps "dateparser>=1.0.0" !pip install -U --no-deps "feedparser>=6.0.8" !pip install pygooglenews==0.1.2

ranjan-ankit avatar Mar 01 '22 22:03 ranjan-ankit