Page MenuHomePhabricator

Page.BotMayEdit() fails for en:Talk:Alan Turing with UnsupportedPageError
Closed, ResolvedPublicBUG REPORT

Description

Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.

import pywikibot
p = pywikibot.Page(pywikibot.Site('wikipedia:en'), 'Talk:Alan Turing')
p.botMayEdit()
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    p.botMayEdit()
  File "D:\pwb\GIT\core\pywikibot\page\_basepage.py", line 1179, in botMayEdit
    self._bot_may_edit = self._check_bot_may_edit()
  File "D:\pwb\GIT\core\pywikibot\page\_basepage.py", line 1196, in _check_bot_may_edit
    templates = self.templatesWithParams()
  File "D:\pwb\GIT\core\pywikibot\page\_page.py", line 81, in templatesWithParams
    for t in self.templates(namespaces=Namespace.TEMPLATE)}
  File "D:\pwb\GIT\core\pywikibot\tools\_deprecate.py", line 508, in wrapper
    return func(*args, **kwargs)
  File "D:\pwb\GIT\core\pywikibot\page\_basepage.py", line 1685, in templates
    self._templates = set(self.itertemplates(content=content))
  File "<frozen _collections_abc>", line 330, in __next__
  File "D:\pwb\GIT\core\pywikibot\tools\collections.py", line 279, in send
    return next(self._started_gen)
  File "D:\pwb\GIT\core\pywikibot\data\api\_generators.py", line 630, in generator
    yield from self._extract_results(resultdata)
  File "D:\pwb\GIT\core\pywikibot\data\api\_generators.py", line 572, in _extract_results
    result = self.result(item)
  File "D:\pwb\GIT\core\pywikibot\data\api\_generators.py", line 741, in result
    update_page(p, pagedata, self.props)
  File "D:\pwb\GIT\core\pywikibot\data\api\_generators.py", line 998, in update_page
    _update_pageid(page, pagedict)
  File "D:\pwb\GIT\core\pywikibot\data\api\_generators.py", line 887, in _update_pageid
    raise UnsupportedPageError(page)
pywikibot.exceptions.UnsupportedPageError: Page [[en:Special:Log]] is not supported due to namespace restriction.

Event Timeline

Xqt changed the task status from Open to In Progress.Oct 19 2024, 8:42 AM
Xqt claimed this task.
Xqt triaged this task as High priority.
Xqt changed the subtype of this task from "Task" to "Bug Report".

Change #1081475 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [fix] no longer raise UnsupportedPageError within PageGenerator.result()

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

Change #1081475 merged by jenkins-bot:

[pywikibot/core@master] [fix] no longer raise UnsupportedPageError within PageGenerator.result()

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