Page MenuHomePhabricator

Imagetransfer.py halts if target page is a redirect (despite being a valid image embedded on pages)
Open, Needs TriagePublic

Description

The script scrapes the filepath of the image anyway, so there should not be an issue with redirection. Worse case it should just give you the option to skip the file, as in the case of an invalid filename, etc. Traceback is as follows:

0. Found image: [[File:Mith.jpg]]
Traceback (most recent call last):
  File "pwb.py", line 262, in <module>
    if not main():
  File "pwb.py", line 255, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "pwb.py", line 121, in run_python_file
    main_mod.__dict__)
  File "./scripts/imagetransfer.py", line 331, in <module>
    main()
  File "./scripts/imagetransfer.py", line 327, in main
    bot.run()
  File "./scripts/imagetransfer.py", line 254, in run
    self.showImageList(imagelist)
  File "./scripts/imagetransfer.py", line 210, in showImageList
    pywikibot.output(image.get())
  File "/home/charitwo/pywikibot/pywikibot/tools/__init__.py", line 1458, in wrapper
    return obj(*__args, **__kw)
  File "/home/charitwo/pywikibot/pywikibot/page.py", line 485, in get
    self._getInternals(sysop)
  File "/home/charitwo/pywikibot/pywikibot/page.py", line 523, in _getInternals
    raise self._getexception
pywikibot.exceptions.IsRedirectPage: Page [[en:File:Mith.jpg]] is a redirect page.
<class 'pywikibot.exceptions.IsRedirectPage'>
CRITICAL: Closing network session.
[charitwo@leviathan pywikibot]$

Event Timeline

charitwo created this task.Jul 25 2017, 1:29 AM
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptJul 25 2017, 1:29 AM
zhuyifei1999 updated the task description. (Show Details)Jul 25 2017, 6:46 AM