Page MenuHomePhabricator

Invalid title error occurred in Redirect.py
Closed, ResolvedPublic

Description

After solving T88800 with https://gerrit.wikimedia.org/r/#/c/189022/ we get in InvalidTitleError:

command:
pwb.py redirect br -always -lang:en

>>> User:SoledadKabocha/sandbox/intentionally broken redirect poundsign <<<
##
Traceback (most recent call last):
  File "C:\Pywikipedia\ssh\pywikibot\core\pwb.py", line 223, in <module>
    run_python_file(filename, argv, argvu, file_package)
  File "C:\Pywikipedia\ssh\pywikibot\core\pwb.py", line 82, in run_python_file
    main_mod.__dict__)
  File "C:\Pywikipedia\ssh\pywikibot\core\scripts\redirect.py", line 794, in <mo
dule>
    main()
  File "C:\Pywikipedia\ssh\pywikibot\core\scripts\redirect.py", line 791, in main
    bot.run()
  File "C:\Pywikipedia\ssh\pywikibot\core\scripts\redirect.py", line 692, in run

    self.delete_broken_redirects()
  File "C:\Pywikipedia\ssh\pywikibot\core\scripts\redirect.py", line 408, in delete_broken_redirects
    self.delete_1_broken_redirect(redir_name)
  File "C:\Pywikipedia\ssh\pywikibot\core\scripts\redirect.py", line 433, in delete_1_broken_redirect
    targetPage.get()
  File "C:\Pywikipedia\ssh\pywikibot\core\pywikibot\tools.py", line 787, in wrapper
    return obj(*__args, **__kw)
  File "C:\Pywikipedia\ssh\pywikibot\core\pywikibot\page.py", line 356, in get
    self._getInternals(sysop)
  File "C:\Pywikipedia\ssh\pywikibot\core\pywikibot\page.py", line 380, in _getInternals
    self.site.loadrevisions(self, getText=True, sysop=sysop)
  File "C:\Pywikipedia\ssh\pywikibot\core\pywikibot\page.py", line 140, in site
    return self._link.site
  File "C:\Pywikipedia\ssh\pywikibot\core\pywikibot\page.py", line 4520, in site

    self.parse()
  File "C:\Pywikipedia\ssh\pywikibot\core\pywikibot\page.py", line 4498, in parse
    raise pywikibot.InvalidTitle("The link does not contain a page "
pywikibot.exceptions.InvalidTitle: The link does not contain a page title
<class 'pywikibot.exceptions.InvalidTitle'>
CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort

c:\Pywikipedia\ssh\pywikibot\core>

hint: name1 of sametitle() is empty

Event Timeline

Xqt raised the priority of this task from to Medium.
Xqt updated the task description. (Show Details)
Xqt added a project: Pywikibot-redirect.py.
Xqt subscribed.
Restricted Application added subscribers: Aklapper, Unknown Object (MLST). · View Herald TranscriptFeb 6 2015, 4:49 PM
Xqt set Security to None.
XZise lowered the priority of this task from Medium to Low.Feb 6 2015, 8:08 PM

Lowered the priority as the chances of this occurring aren't very high. At least I don't know how such redirects are created. The basic problem is that when a redirect is only the fragment (like [[#sth]]), there is no link title which is an invalid title. I'm not sure if this can be considered a problem of the Link class, as a link without a page is valid but to the own page.

gerritbot subscribed.

Change 189028 had a related patch set uploaded (by John Vandenberg):
[bugfix] Pass invalid title error in redirect.py

https://gerrit.wikimedia.org/r/189028

Patch-For-Review

Change 189028 merged by jenkins-bot:
[bugfix] Ignore invalid title error in redirect.py

https://gerrit.wikimedia.org/r/189028