WikiTeam / wikiteam

Tools for downloading and preserving wikis. We archive wikis, from Wikipedia to tiniest wikis. As of 2023, WikiTeam has preserved more than 350,000 wikis.
https://github.com/WikiTeam
GNU General Public License v3.0
705 stars 147 forks source link

Fix wrong urllib module call in Python 2 #466

Closed GT-610 closed 1 year ago

GT-610 commented 1 year ago

Description:

Addresses an issue where the AttributeError: 'module' object has no attribute 'parse' error occurs in the generateImageDump function of the dumpgenerator.py file. The error is encountered when running the program using Python 2.

Issue:

The error arises because the code attempts to import and use the urllib.parse module, which is only available in Python 3.

Resolution:

To resolve the issue, the code has been modified to import the correct module based on the Python version being used. The try-except block has been updated to import the urlparse function from the urlparse module in Python 2 and from the urllib.parse module in Python 3.

As this program is designed for Python 2 and can't be operated on Python 3 even with 2to3, I think using Python 3 libraries is not needed.

nemobis commented 1 year ago

Thanks!