Page MenuHomePhabricator

archivebot fails due to wrong parsing templates
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue:

archivebot fails if template fields are using decimal field types like %(counter)d.

What happens?:

D:\pwb\GIT\core>pwb archivebot User:MiszaBot/config -simulate -lang:simple
Fetching template transclusions...
Processing [[simple:Talk:Main Page]]
15 thread(s) found on [[simple:Talk:Main Page]]
Looking for: {{User:MiszaBot/config}} in [[simple:Talk:Main Page]]
Processing 15 threads
Talk:Main Page/Archive%(counter)d
{'counter': '5', 'year': '2021', 'isoyear': '2021', 'isoweek': '26', 'semester': '1', 'quarter': '2', 'month': '6', 'monthname': 'June', 'monthnameshort': 'Jun', 'week': '26'}
ERROR: Error occurred while processing page [[simple:Talk:Main Page]]
Traceback (most recent call last):
  File ".\scripts\archivebot.py", line 804, in main
    archiver.run()
  File ".\scripts\archivebot.py", line 657, in run
    whys = self.analyze_page()
  File ".\scripts\archivebot.py", line 586, in analyze_page
    key = pattern % params
TypeError: %d format: a real number is required, not strProcessing [[simple:Talk:X64]]
2 thread(s) found on [[simple:Talk:X64]]
Looking for: {{User:MiszaBot/config}} in [[simple:Talk:X64]]
Traceback (most recent call last):
   ...
KeyboardInterrupt
CRITICAL: Exiting due to uncaught exception <class 'KeyboardInterrupt'>

What should have happened instead?:

Software version (skip for WMF-hosted wikis like Wikipedia):
Since Pywikibot 7.5 due to rPWBC1225e3d99

Related Objects

Event Timeline

Xqt changed the task status from Open to In Progress.Jul 24 2022, 4:41 PM
Xqt claimed this task.
Xqt triaged this task as High priority.

Hi, Xqt I got that too using the shared library but different line numbers:

File "/data/project/shared/pywikibot/stable/scripts/archivebot.py", line 801, in main
  archiver.run()
File "/data/project/shared/pywikibot/stable/scripts/archivebot.py", line 654, in run
  whys = self.analyze_page()
File "/data/project/shared/pywikibot/stable/scripts/archivebot.py", line 584, in analyze_page
  key = pattern % params

Hi, Xqt I got that too using the shared library but different line numbers:

Your lines are right, I added some debugging lines for me.

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

[pywikibot/core@master] [BUGFIX] replace archive pattern fields to string conversion

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

Change 816323 merged by jenkins-bot:

[pywikibot/core@master] [BUGFIX] replace archive pattern fields to string conversion

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

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

[pywikibot/core@stable] [BUGFIX] replace archive pattern fields to string conversion

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

Change 816346 merged by jenkins-bot:

[pywikibot/core@stable] [BUGFIX] replace archive pattern fields to string conversion

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

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

[pywikibot/core@master] [BUGFIX] Add localized "archive" variables to archivebot.py

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

Change 816703 merged by jenkins-bot:

[pywikibot/core@master] [BUGFIX] Add localized "archive" variables to archivebot.py

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

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

[pywikibot/core@stable] [backport] backport archivebot.py from master

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

Change 817363 merged by Xqt:

[pywikibot/core@stable] [backport] backport archivebot.py from master

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