Page MenuHomePhabricator conflict with wikidata usage
Closed, DuplicatePublic


>>> Germania <<<
Retrieving 50 pages from wikipedia:it.
Retrieving 50 pages from wikipedia:it.
Traceback (most recent call last):
  File "", line 239, in <module>
    if not main():
  File "", line 233, in main
    run_python_file(filename, argv, argvu, file_package)
  File "", line 88, in run_python_file
  File "./scripts/", line 230, in <module>
  File "./scripts/", line 225, in main
  File "./scripts/", line 179, in workon
    text = treat(text, page2, target)
  File "./scripts/", line 85, in treat
    if actualLinkPage != linkedPage:
  File "/home/.../core/pywikibot/tools/", line 139, in __ne__
    return other != self._cmpkey()
  File "/home/.../core/pywikibot/", line 288, in _cmpkey
    return (, self.namespace(), self.title())
  File "/home/.../core/pywikibot/", line 141, in site
  File "/home/.../core/pywikibot/", line 4687, in site
  File "/home/.../core/pywikibot/", line 4641, in parse
    u"%s contains illegal char(s) %s" % (repr(t), repr(
pywikibot.exceptions.InvalidTitle: u'{{' contains illegal char(s) u'{'
<class 'pywikibot.exceptions.InvalidTitle'>

The problem is the {{ }} within [[ ]] in [[{{#property:p30}}]]. This actually involves also some weird combination such as [[{{CURRENTYEAR}}]] but Wikidata's usage is definitely the most important situation. The best solution would be simply ignoring links including illegal chars (maybe reporting them somewhere or in summary).

Event Timeline

Vituzzu raised the priority of this task from to Needs Triage.
Vituzzu updated the task description. (Show Details)
Vituzzu added a project: Pywikibot.
Vituzzu added a subscriber: Vituzzu.
Vituzzu set Security to None.

The general idea seems similar to T103080: Link should recognise {{ns:Project}} in text although this here is far more complex. If we implement this here it seems that we need to implement some default templates like {{CURRENTYEAR}} and parse them manually and replace the result. {{#property:p30}} also requires some wikibase magic and can't be implemented statically.

Dvorapa added a subscriber: Dvorapa.

Let's merge them as the general issue is basically the same.

Dvorapa triaged this task as Low priority.
Dvorapa added a project: good first task.
Dvorapa moved this task from Backlog to Doing on the good first task board.

Change 395154 had a related patch set uploaded (by Dvorapa; owner: Dvorapa):
[pywikibot/core@master] [bugfix] Don't handle category prefixes as iw shortcuts