Page MenuHomePhabricator uncaught exception: InvalidTitle: '{{PAGENAME}}' contains illegal char(s) '{'
Open, MediumPublic


Command line:

python3 commonscat -lang:ary -start:!


Retrieving 1 pages from wikipedia:ary.

>>> أحلاف <<<

0 pages read
0 pages written
0 pages skipped
Execution time: 6 seconds
Script terminated by exception:

ERROR: InvalidTitle: '{{PAGENAME}}' contains illegal char(s) '{'
Traceback (most recent call last):
  File "", line 363, in <module>
    if not main():
  File "", line 358, in main
  File "", line 75, in run_python_file
  File "./scripts/", line 561, in <module>
  File "./scripts/", line 555, in main
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/", line 1487, in run
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/", line 1766, in treat
  File "./scripts/", line 316, in treat_page
    commonscatLink = self.find_commons_category(page)
  File "./scripts/", line 417, in find_commons_category
    return self.findCommonscatLink(page)
  File "./scripts/", line 385, in findCommonscatLink
  File "./scripts/", line 464, in checkCommonscatLink
    if not commonsPage.exists():
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/page/", line 775, in exists
    return self.pageid > 0
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/page/", line 292, in pageid
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/page/", line 228, in site
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/page/", line 6010, in site
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/page/", line 5965, in parse
    '%r contains illegal char(s) %r' % (t,
pywikibot.exceptions.InvalidTitle: '{{PAGENAME}}' contains illegal char(s) '{'
CRITICAL: Exiting due to uncaught exception <class 'pywikibot.exceptions.InvalidTitle'>


  • When running the script, the bot crashes when encountering the above error.
  • This is annoying as I have to manually restart the bot again.



Please implement the same fix for (i.e. make the bot skip the page in this case instead of crashing). Thank you.

Version information:

Pywikibot: [https] r-pywikibot-core (fae6c25, g13693, 2020/11/11, 11:39:36, master)
Release version: 5.2.0.dev0
requests version: 2.21.0
  cacerts: /etc/ssl/certs/ca-certificates.crt
    certificate test: ok
Python: 3.5.3 (default, Jul  9 2020, 13:00:10)
[GCC 6.3.0 20170516]

Event Timeline

Meno25 created this task.Nov 11 2020, 4:07 PM
Restricted Application added subscribers: pywikibot-bugs-list, alaa, Aklapper. · View Herald TranscriptNov 11 2020, 4:07 PM
Meno25 updated the task description. (Show Details)Nov 11 2020, 4:09 PM
Meno25 updated the task description. (Show Details)Nov 11 2020, 4:41 PM
Xqt triaged this task as Medium priority.Nov 11 2020, 6:07 PM
Xqt added a subscriber: Xqt.

@Meno25: you are the perfect beta-tester 😉

@Meno25: you are the perfect beta-tester 😉

Thank you ❤😊😊