Page MenuHomePhabricator

Handle InvalidTitle Error in preloading pages
Closed, ResolvedPublic

Description

Retrieving special page...
Traceback (most recent call last):
  File "C:\pwb\core\pwb.py", line 253, in <module>
    if not main():
  File "C:\pwb\core\pwb.py", line 247, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "C:\pwb\core\pwb.py", line 120, in run_python_file
    main_mod.__dict__)
  File ".\scripts\redirect.py", line 909, in <module>
    main()
  File ".\scripts\redirect.py", line 896, in main
    bot.run()
  File ".\scripts\redirect.py", line 765, in run
    self.delete_broken_redirects()
  File ".\scripts\redirect.py", line 458, in delete_broken_redirects
    for redir_name in self.generator.retrieve_broken_redirects():
  File ".\scripts\redirect.py", line 351, in retrieve_broken_redirects
    for page in self.site.preloadpages(self.site.broken_redirects()):
  File "C:\pwb\core\pywikibot\site.py", line 3103, in preloadpages
    cache = dict((p.title(withSection=False), p) for p in sublist)
  File "C:\pwb\core\pywikibot\site.py", line 3103, in <genexpr>
    cache = dict((p.title(withSection=False), p) for p in sublist)
  File "C:\pwb\core\pywikibot\tools\__init__.py", line 1359, in wrapper
    return obj(*__args, **__kw)
  File "C:\pwb\core\pywikibot\page.py", line 243, in title
    title = self._link.canonical_title()
  File "C:\pwb\core\pywikibot\page.py", line 5149, in canonical_title
    if self.namespace:
  File "C:\pwb\core\pywikibot\page.py", line 5111, in namespace
    self.parse()
  File "C:\pwb\core\pywikibot\page.py", line 5047, in parse
    "in another namespace.".format(self._text))
pywikibot.exceptions.InvalidTitle: The (non-)talk page of 'M┼ìtung:ÃÀicipÃúdia:G
┼ìd ╚Øeã┐rit ╚Øenamunga' is a valid title in another namespace.
<class 'pywikibot.exceptions.InvalidTitle'>
CRITICAL: Closing network session.

See https://ang.wikipedia.org/wiki/Syndrig:BrokenRedirects

The invalid page is
https://ang.wikipedia.org/w/index.php?title=M%C5%8Dtung:%C7%B7icip%C7%A3dia:G%C5%8Dd_%C8%9De%C6%BFrit_%C8%9Denamunga&redirect=no

Event Timeline

Xqt raised the priority of this task from to Medium.
Xqt updated the task description. (Show Details)
Xqt added a project: Pywikibot.
Xqt subscribed.

Once again:

>>> Fixing redirects on wikipedia:ang <<<
Retrieving special page...
Traceback (most recent call last):
  File "C:\pwb\core\pwb.py", line 256, in <module>
    if not main():
  File "C:\pwb\core\pwb.py", line 250, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "C:\pwb\core\pwb.py", line 121, in run_python_file
    main_mod.__dict__)
  File ".\scripts\redirect.py", line 911, in <module>
    bot = RedirectRobot(action, gen, number=number, **options)
  File ".\scripts\redirect.py", line 898, in main
    try:
  File ".\scripts\redirect.py", line 767, in run
    elif self.action == 'broken':
  File ".\scripts\redirect.py", line 458, in delete_broken_redirects
    # get reason for deletion text
  File ".\scripts\redirect.py", line 351, in retrieve_broken_redirects
    pywikibot.output(u'Retrieving special page...')
  File "C:\pwb\core\pywikibot\site.py", line 3107, in preloadpages
    cache = dict((p.title(withSection=False), p) for p in sublist)
  File "C:\pwb\core\pywikibot\site.py", line 3107, in <genexpr>
    cache = dict((p.title(withSection=False), p) for p in sublist)
  File "C:\pwb\core\pywikibot\tools\__init__.py", line 1359, in wrapper
    return obj(*__args, **__kw)
  File "C:\pwb\core\pywikibot\page.py", line 243, in title
    title = self._link.canonical_title()
  File "C:\pwb\core\pywikibot\page.py", line 5161, in canonical_title
    if self.namespace:
  File "C:\pwb\core\pywikibot\page.py", line 5123, in namespace
    self.parse()
  File "C:\pwb\core\pywikibot\page.py", line 5059, in parse
    "in another namespace.".format(self._text))
pywikibot.exceptions.InvalidTitle: The (non-)talk page of 'M┼ìtung:ÃÀicipÃúdia:G
┼ìd ╚Øeã┐rit ╚Øenamunga' is a valid title in another namespace.
<class 'pywikibot.exceptions.InvalidTitle'>
CRITICAL: Closing network session.
Xqt raised the priority of this task from Medium to High.Feb 28 2016, 8:08 AM
Xqt added a project: Pywikibot-redirect.py.

Change 279584 had a related patch set uploaded (by Xqt):
[bugfix] Ignore InvalidTitleError in Site.preloadpages

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

Could you provide the command that you are using?
I'd like to see why an invalid title is being sent to preloadpages

(also could you give the correct unicode in the task description for whatever page title caused this, instead of M┼ìtung:ÃÀicipÃúdia:G┼ìd ╚Øeã┐rit ╚Øenamunga

The command line is just trivial:

C:\pwb\GIT\core>pwb.py redirect br -lang:ang
Retrieving broken redirect special page...
Traceback (most recent call last):
  File "C:\pwb\GIT\core\pwb.py", line 256, in <module>
    if not main():
  File "C:\pwb\GIT\core\pwb.py", line 250, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "C:\pwb\GIT\core\pwb.py", line 121, in run_python_file
    main_mod.__dict__)
  File ".\scripts\redirect.py", line 804, in <module>
    main()
  File ".\scripts\redirect.py", line 801, in main
    bot.run()
  File ".\scripts\redirect.py", line 702, in run
    self.delete_broken_redirects()
  File ".\scripts\redirect.py", line 430, in delete_broken_redirects
    for redir_name in self.generator.retrieve_broken_redirects():
  File ".\scripts\redirect.py", line 299, in retrieve_broken_redirects
    for page in self.site.preloadpages(self.site.broken_redirects()):
  File "C:\pwb\GIT\core\pywikibot\site.py", line 3107, in preloadpages
    cache = dict((p.title(withSection=False), p) for p in sublist)
  File "C:\pwb\GIT\core\pywikibot\site.py", line 3107, in <genexpr>
    cache = dict((p.title(withSection=False), p) for p in sublist)
  File "C:\pwb\GIT\core\pywikibot\tools\__init__.py", line 1414, in wrapper
    return obj(*__args, **__kw)
  File "C:\pwb\GIT\core\pywikibot\page.py", line 250, in title
    title = self._link.canonical_title()
  File "C:\pwb\GIT\core\pywikibot\page.py", line 5152, in canonical_title
    if self.namespace != Namespace.MAIN:
  File "C:\pwb\GIT\core\pywikibot\page.py", line 5113, in namespace
    self.parse()
  File "C:\pwb\GIT\core\pywikibot\page.py", line 5049, in parse
    "in another namespace.".format(self._text))
pywikibot.exceptions.InvalidTitle: The (non-)talk page of 'M┼ìtung:ÃÀicipÃúdia:G
┼ìd ╚Øeã┐rit ╚Øenamunga' is a valid title in another namespace.
<class 'pywikibot.exceptions.InvalidTitle'>
CRITICAL: Closing network session.

C:\pwb\GIT\core>

The corresponding line in special page is

  1. Mōtung:Ƿicipǣdia:Ƿicibōceras (bearbeiten) → Mōtung:Wikipǣdia:Wikibōceras

Change 279584 had a related patch set uploaded (by Xqt):
[bugfix] Ignore InvalidTitle error in Site.preloadpages

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

Change 279584 merged by jenkins-bot:
[bugfix] Ignore InvalidTitle error in Site.preloadpages

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