Page MenuHomePhabricator

imageharvest.py does not run (throws an error) on Python 2
Closed, DuplicatePublic

Description

Steps to reproduce

$ python2 pwb.py imageharvest -simulate
WARNING: /home/pavel/pywikibot/pywikibot/__init__.py:132: FutureWarning: 
Python 2.7.16 will be dropped in 2020.
It is recommended to use Python 3.5 or above.
See T213287 for further information.

  FutureWarning)

From what URL should I get the images? https://upload.wikimedia.org/wikipedia/commons/8/80/Wikipedia-logo-v2.svg
What text should be added at the end of the description of each image from this url? 
Traceback (most recent call last):
  File "pwb.py", line 250, in <module>
    if not main():
  File "pwb.py", line 245, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "pwb.py", line 95, in run_python_file
    main_mod.__dict__)
  File "./scripts/imageharvest.py", line 161, in <module>
    main()
  File "./scripts/imageharvest.py", line 157, in main
    run_bot(url, image_url, desc)
  File "./scripts/imageharvest.py", line 111, in run_bot
    ilinks = get_imagelinks(url)
  File "./scripts/imageharvest.py", line 55, in get_imagelinks
    with urlopen(url) as f:
AttributeError: addinfourl instance has no attribute '__exit__'
CRITICAL: Exiting due to uncaught exception <type 'exceptions.AttributeError'>