Nandaka / PixivUtil2

Download images from Pixiv and more!
http://nandaka.devnull.zone/
BSD 2-Clause "Simplified" License
2.35k stars 258 forks source link

Recent mechanize update breaks script #218

Closed tateMode closed 7 years ago

tateMode commented 7 years ago
PixivDownloader2 version 20170220
https://github.com/Nandaka/PixivUtil2/releases
Donate at https://bit.ly/PixivUtilDonation
Reading /opt/pixiv-downloader-20170220/config.ini ...
done.
Traceback (most recent call last):
  File "PixivUtil2.py", line 1902, in <module>
    main()
  File "PixivUtil2.py", line 1779, in main
    __br__ = PixivBrowserFactory.getBrowser(config=__config__)
  File "/opt/pixiv-downloader-20170220/PixivBrowserFactory.py", line 515, in getBrowser
    _browser = PixivBrowser(defaultConfig, defaultCookieJar)
  File "/opt/pixiv-downloader-20170220/PixivBrowserFactory.py", line 35, in __init__
    mechanize.Browser.__init__(self, factory=mechanize.RobustFactory())
AttributeError: 'module' object has no attribute 'RobustFactory'

The script fails to start as per the error above. Tested with a fresh repository clone.

I run a Linux system and looking through my update log, I see that mechanize was recently updated from 0.2.5 to 0.3.1. Downgrading this package enabled the script to start up and log me in again. Haven't had a chance to test if the script can successfully download something after downgrading; there were a few other dependencies which recently received minor updates as well (numpy and imageio spring to mind).

Edit: Downloading still works after downgrading mechanize, so it's just mechanize that's the problem.

Nandaka commented 7 years ago

From their github:

Yes, as per the Changelog, mechanize.Browser does not accept the factory argument anymore. All HTML parsing is done using html5lib.

If you are using v3.x, you need to manually remove the factory parameter from https://github.com/Nandaka/PixivUtil2/blob/master/PixivBrowserFactory.py#L35

I need to check the compatibiliy before I've update the libs.