Page MenuHomePhabricator

interwikidata.py breaks if the page contains interwiki link that is a redirect
Open, MediumPublicBUG REPORT

Description

e.g. pwb.py interwikidata -page:"Atol Majuro" -lang:id -create

ERROR: OtherPageSaveError: Edit to page [[wikidata:-1]] failed:
failed-save: The save has failed. [help:See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes.]
Traceback (most recent call last):
  File "/srv/paws/pwb/pywikibot/page.py", line 107, in handle
    func(self, *args, **kwargs)
  File "/srv/paws/pwb/pywikibot/page.py", line 4217, in editEntity
    baserevid=baserevid, **kwargs)
  File "/srv/paws/pwb/pywikibot/site.py", line 1320, in callee
    return fn(self, *args, **kwargs)
  File "/srv/paws/pwb/pywikibot/site.py", line 7839, in editEntity
    data = req.submit()
  File "/srv/paws/pwb/pywikibot/data/api.py", line 2079, in submit
    raise APIError(**result['error'])
pywikibot.data.api.APIError: failed-save: The save has failed. [help:See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes.]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/paws/pwb/pwb.py", line 250, in <module>
    if not main():
  File "/srv/paws/pwb/pwb.py", line 243, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "/srv/paws/pwb/pwb.py", line 95, in run_python_file
    main_mod.__dict__)
  File "./scripts/interwikidata.py", line 246, in <module>
    main()
  File "./scripts/interwikidata.py", line 239, in main
    bot.run()
  File "/srv/paws/pwb/pywikibot/bot.py", line 1505, in run
    self.treat(page)
  File "/srv/paws/pwb/pywikibot/bot.py", line 1732, in treat
    self.treat_page()
  File "./scripts/interwikidata.py", line 93, in treat_page
    item = self.create_item()
  File "./scripts/interwikidata.py", line 126, in create_item
    item.editEntity(data, new='item', summary=summary)
  File "/srv/paws/pwb/pywikibot/page.py", line 128, in wrapper
    handle(func, self, *args, **kwargs)
  File "/srv/paws/pwb/pywikibot/page.py", line 120, in handle
    raise pywikibot.OtherPageSaveError(self, err)
pywikibot.exceptions.OtherPageSaveError: Edit to page [[wikidata:-1]] failed:
failed-save: The save has failed. [help:See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.]
CRITICAL: Exiting due to uncaught exception <class 'pywikibot.exceptions.OtherPageSaveError'>

Event Timeline

Xqt triaged this task as Medium priority.Jul 10 2019, 5:49 AM
Xqt added a project: Pywikibot-Scripts.
Xqt changed the subtype of this task from "Task" to "Bug Report".

Aby progress?

I:\pwb>pwb.py interwikidata  -unconnectedpages -create -lang:zh-yue -maxlag:30 -merge

...

>>> Molas, France <<<
Interwiki [[en:Molas, France]] does not have an item
WARNING: I:\pwb\pywikibot\site\_decorators.py:92: UserWarning: Unknown wbeditentity parameter new ignored
  return fn(self, *args, **kwargs)

WARNING: API error failed-save: The save has failed.

85 pages read
0 pages written
0 pages skipped
Execution time: 251 seconds
Read operation time: 3.0 seconds
Script terminated by exception:

ERROR: OtherPageSaveError: Edit to page [[wikidata:-1]] failed:
failed-save: The save has failed.
[messages: [{'name': 'wikibase-api-failed-save', 'parameters': [], 'html': {'*': 'The save has failed.'}}, {'name': 'wikibase-validator-sitelink-conflict', 'parameters': ['[https://en.wikipedia.org/wiki/Molas,_Haute-Garonne enwiki:Molas, Haute-Garonne]', '[[Q1430060|Q1430060]]'], 'html': {'*': 'Odkaz <a class="external text" href="https://en.wikipedia.org/wiki/Molas,_Haute-Garonne">enwiki:Molas, Haute-Garonne</a> je již použit položkou <a href="/wiki/Q1430060" title="Q1430060">Q1430060</a>. Možná mohou být položky <a href="/wiki/Help:Merge/cs" title="Help:Merge/cs">sloučeny</a> nebo jedna z nich <a href="/wiki/Wikidata:RfD" class="mw-redirect" title="Wikidata:RfD">smazána</a>. Nebojte se <a href="/wiki/Wikidata:Mezi_bajty" title="Wikidata:Mezi bajty">zeptat</a>.'}}];
 help: See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.]
Traceback (most recent call last):
  File "I:\pwb\pywikibot\page\_decorators.py", line 33, in handle
    func(self, *args, **kwargs)
  File "I:\pwb\pywikibot\page\__init__.py", line 3669, in editEntity
    super().editEntity(data, **kwargs)
  File "I:\pwb\pywikibot\page\__init__.py", line 3419, in editEntity
    updates = self.repo.editEntity(
  File "I:\pwb\pywikibot\tools\_deprecate.py", line 404, in wrapper
    return obj(*__args, **__kw)
  File "I:\pwb\pywikibot\site\_decorators.py", line 92, in callee
    return fn(self, *args, **kwargs)
  File "I:\pwb\pywikibot\site\_datasite.py", line 344, in editEntity
    return req.submit()
  File "I:\pwb\pywikibot\data\api.py", line 1868, in submit
    raise pywikibot.exceptions.APIError(**result['error'])
pywikibot.exceptions.APIError: failed-save: The save has failed.
[messages: [{'name': 'wikibase-api-failed-save', 'parameters': [], 'html': {'*': 'The save has failed.'}}, {'name': 'wikibase-validator-sitelink-conflict', 'parameters': ['[https://en.wikipedia.org/wiki/Molas,_Haute-Garonne enwiki:Molas, Haute-Garonne]', '[[Q1430060|Q1430060]]'], 'html': {'*': 'Odkaz <a class="external text" href="https://en.wikipedia.org/wiki/Molas,_Haute-Garonne">enwiki:Molas, Haute-Garonne</a> je již použit položkou <a href="/wiki/Q1430060" title="Q1430060">Q1430060</a>. Možná mohou být položky <a href="/wiki/Help:Merge/cs" title="Help:Merge/cs">sloučeny</a> nebo jedna z nich <a href="/wiki/Wikidata:RfD" class="mw-redirect" title="Wikidata:RfD">smazána</a>. Nebojte se <a href="/wiki/Wikidata:Mezi_bajty" title="Wikidata:Mezi bajty">zeptat</a>.'}}];
 help: See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "I:\pwb\pwb.py", line 399, in <module>
    if not main():
  File "I:\pwb\pwb.py", line 391, in main
    run_python_file(filename,
  File "I:\pwb\pwb.py", line 106, in run_python_file
    exec(compile(source, filename, 'exec', dont_inherit=True),
  File ".\scripts\interwikidata.py", line 249, in <module>
    main()
  File ".\scripts\interwikidata.py", line 243, in main
    bot.run()
  File "I:\pwb\pywikibot\bot.py", line 1569, in run
    self.treat(page)
  File "I:\pwb\pywikibot\bot.py", line 1821, in treat
    self.treat_page()
  File ".\scripts\interwikidata.py", line 97, in treat_page
    item = self.create_item()
  File ".\scripts\interwikidata.py", line 130, in create_item
    item.editEntity(data, new='item', summary=summary)
  File "I:\pwb\pywikibot\page\_decorators.py", line 54, in wrapper
    handle(func, self, *args, **kwargs)
  File "I:\pwb\pywikibot\page\_decorators.py", line 46, in handle
    raise OtherPageSaveError(self, err)
pywikibot.exceptions.OtherPageSaveError: Edit to page [[wikidata:-1]] failed:
failed-save: The save has failed.
[messages: [{'name': 'wikibase-api-failed-save', 'parameters': [], 'html': {'*': 'The save has failed.'}}, {'name': 'wikibase-validator-sitelink-conflict', 'parameters': ['[https://en.wikipedia.org/wiki/Molas,_Haute-Garonne enwiki:Molas, Haute-Garonne]', '[[Q1430060|Q1430060]]'], 'html': {'*': 'Odkaz <a class="external text" href="https://en.wikipedia.org/wiki/Molas,_Haute-Garonne">enwiki:Molas, Haute-Garonne</a> je již použit položkou <a href="/wiki/Q1430060" title="Q1430060">Q1430060</a>. Možná mohou být položky <a href="/wiki/Help:Merge/cs" title="Help:Merge/cs">sloučeny</a> nebo jedna z nich <a href="/wiki/Wikidata:RfD" class="mw-redirect" title="Wikidata:RfD">smazána</a>. Nebojte se <a href="/wiki/Wikidata:Mezi_bajty" title="Wikidata:Mezi bajty">zeptat</a>.'}}];
 help: See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.]
CRITICAL: Exiting due to uncaught exception <class 'pywikibot.exceptions.OtherPageSaveError'>