Page MenuHomePhabricator

pywikibot interwiki crashes on category redirects
Closed, InvalidPublic

Description

Interwiki bot (core) crashes on redirected categories.

pwb.py interwiki -family:wiktionary -start:category:! -lang:sg

Retrieving 10 pages from wiktionary:de.
WARNING: D:\pwb\pywikibot\family.py:900: FamilyMaintenanceWarning: Family name w
ikimediachapter does not match family module name wikimedia
Retrieving 10 pages from wiktionary:uz.
Retrieving 10 pages from wiktionary:ro.
Retrieving 10 pages from wiktionary:tn.
Dump sg (wiktionary) appended.
Traceback (most recent call last):
  File "D:\pwb\pwb.py", line 213, in <module>
    run_python_file(filename, argv, argvu, file_package)
  File "D:\pwb\pwb.py", line 82, in run_python_file
    main_mod.__dict__)
  File ".\scripts\interwiki.py", line 2645, in <module>
    main()
  File ".\scripts\interwiki.py", line 2620, in main
    bot.run()
  File ".\scripts\interwiki.py", line 2360, in run
    self.queryStep()
  File ".\scripts\interwiki.py", line 2333, in queryStep
    self.oneQuery()
  File ".\scripts\interwiki.py", line 2329, in oneQuery
    subject.batchLoaded(self)
  File ".\scripts\interwiki.py", line 1455, in batchLoaded
    elif page.isEmpty() and not page.isCategory():
  File "D:\pwb\pywikibot\page.py", line 688, in isEmpty
    txt = self.get()
  File "D:\pwb\pywikibot\tools.py", line 869, in wrapper
    return obj(*__args, **__kw)
  File "D:\pwb\pywikibot\page.py", line 354, in get
    self._getInternals(sysop)
  File "D:\pwb\pywikibot\page.py", line 386, in _getInternals
    raise self._getexception
pywikibot.exceptions.IsRedirectPage: Page [[tn:Category:Inli]] is a redirect pag
e.
<class 'pywikibot.exceptions.IsRedirectPage'>
CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort

Also it does not work correctly with -ignore parameter

D:\pwb>pwb.py interwiki -family:wiktionary -lang:sg -start:category:! -whenneede
d -untranslated -ignore:tn:category:Inli
Traceback (most recent call last):
  File "D:\pwb\pwb.py", line 213, in <module>
    run_python_file(filename, argv, argvu, file_package)
  File "D:\pwb\pwb.py", line 82, in run_python_file
    main_mod.__dict__)
  File ".\scripts\interwiki.py", line 2645, in <module>
    main()
  File ".\scripts\interwiki.py", line 2486, in main
    if globalvar.readOptions(arg):
  File ".\scripts\interwiki.py", line 581, in readOptions
    self.ignore += [pywikibot.Page(None, p) for p in arg[8:].split(",")]
  File "D:\pwb\pywikibot\tools.py", line 869, in wrapper
    return obj(*__args, **__kw)
  File "D:\pwb\pywikibot\tools.py", line 869, in wrapper
    return obj(*__args, **__kw)
  File "D:\pwb\pywikibot\page.py", line 1858, in __init__
    super(Page, self).__init__(source, title, ns)
  File "D:\pwb\pywikibot\page.py", line 133, in __init__
    % (type(source), source))
pywikibot.exceptions.Error: Invalid argument type '<type 'NoneType'>' in Page co
nstructor: None
<class 'pywikibot.exceptions.Error'>
CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort

Event Timeline

JAnD created this task.Feb 18 2015, 7:56 AM
JAnD raised the priority of this task from to Needs Triage.
JAnD updated the task description. (Show Details)
JAnD added a subscriber: JAnD.
Restricted Application added subscribers: Aklapper, Unknown Object (MLST). · View Herald TranscriptFeb 18 2015, 7:56 AM
JAnD triaged this task as High priority.Feb 18 2015, 7:57 AM
JAnD set Security to None.

See also 87222

Mpaa added a subscriber: Mpaa.Feb 18 2015, 10:00 PM

Regarding the first point, the bot crashes because the page is a redirect, not because it is a Category.
I was not able to reproduce it.
And it is quite strange it reaches line 1455 as it should be caught by line 1320:

1320    elif page.isRedirectPage() or page.isCategoryRedirect():
           ...
           continue
Mpaa added a comment.Feb 18 2015, 10:18 PM

See also 87222

T87222

JAnD added a comment.Feb 23 2015, 10:01 PM

Not only category redirects: try interwiki for sk:femeia

pwb.py interwiki femeia -family:wiktionary -wiktionary -lang:sk

Mpaa added a comment.EditedFeb 23 2015, 10:14 PM

I was not able to reproduce this one as well.
Are you using the latest version?

user@pc:~/python/core {interwiki}$ python pwb.py interwiki femeia -family:wiktionary -wiktionary -lang:sk
Retrieving 1 pages from wiktionary:sk.
Retrieving 1 pages from wiktionary:lb.
NOTE: [[lb:femeia]] does not exist. Skipping.
Retrieving 1 pages from wiktionary:kl.
...
======Post-processing [[sk:femeia]]======
...
WARNING: wiktionary: [[fr:femeia]] links to incorrect [[hu:femeia]]
Ladsgroup closed this task as Invalid.May 10 2015, 10:42 PM
Ladsgroup added a subscriber: Ladsgroup.

Feel free to repoen it if It happens in an updated version of pywikibot.