Page MenuHomePhabricator

UserWarning: Site wikipedia:be-tarask instantiated using different code "be-x-old"
Open, Needs TriagePublic

Description

When I run any script, this shows as warning: UserWarning: Site wikipedia:be-tarask instantiated using different code "be-x-old"

See example output:

kizule@kizule:~/development/pywikibot-core$ python3 pwb.py disambredir
/home/kizule/development/pywikibot-core/pywikibot/config2.py:1138: _ConfigurationDeprecationWarning: "sysopnames" present in our user-config.py is no longer a supported configuration variable. Please inform the maintainers if you depend on it.
  'depend on it.'.format(_key), _ConfigurationDeprecationWarning)
WARNING: /home/kizule/development/pywikibot-core/pywikibot/site.py:1893: UserWarning: Site wikipedia:be-tarask instantiated using different code "be-x-old"
  return pywikibot.Site(lang, site['code'])

Upstream: T235505: Rename be-x-old as be-tarask in Wikidata
Related: T111853: The href of be-tarask: interlanguage link points to the be-x-old domain

Event Timeline

Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptSep 28 2019, 11:16 PM
Xqt added a subscriber: Xqt.Sep 29 2019, 2:09 AM

On which site are you running that script? And what do you mean with "running any script"? The warning is valid as long as the script finds this old identifier.

On which site are you running that script? And what do you mean with "running any script"? The warning is valid as long as the script finds this old identifier.

Serbian Wikipedia. Running any script means running each script which pywikibot have throws this warning.

Huji added a subscriber: Huji.May 27 2020, 1:19 AM

I have been getting this occasionally too. It does not occur every time (indeed, it happens rarely) so I am guessing there is a condition race going on somewhere in the code.

Huji added a comment.May 27 2020, 2:00 AM

In further investigation: it happens only when I use pywikibot to query an item on Wikidata that has a sitelink for be_x_old, such as Q4048908. I am not sure why wikidata shows those sitelinks as be_x_old when the link itself goes to a page like be-tarask.wikipedia.or/wiki/foobar but in any case, I don't think fixing it upstream in Wikidata would be a realistic answer here. So my proposal is: when we run into be_x_old in a Wikidata query, we should gracefully ignore that and not show the warning above.

@Xqt what do you think?


Here is a piece of code that gives me the error every time:

page = pywikibot.Page(pywikibot.Site('en', 'wikipedia'), 'Category:Hidden categories')
item = pywikibot.ItemPage.fromPage(page)
Huji updated the task description. (Show Details)May 28 2020, 11:59 AM
Xqt added a comment.EditedMay 29 2020, 7:43 AM

The following patch might help: https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/WikimediaMaintenance/+/587863/
Two months waiting for a review

Still occurres with the sample given by Huji above. Wikidata accepts be_x_old as site code but it does not accept be-tarask.

Well, the patch to wikis will be deployed next thursday, then we can test, how our issues with be-tarask/be-x-old changed

Huji added a subscriber: Ladsgroup.May 29 2020, 1:01 PM

In fact, I think after the patch to wiki is deployed (next week) some additional step needs to be taken (@Ladsgroup described it as "rebuild the interwiki cache" but I am not sure the effort involved) so it may take a bit longer until we can actually test this.

Huji updated the task description. (Show Details)May 29 2020, 1:01 PM
Dvorapa added a comment.EditedMay 30 2020, 8:25 AM

(@Ladsgroup described it as "rebuild the interwiki cache" but I am not sure the effort involved) so it may take a bit longer until we can actually test this.

It's just one command to be run, quick and easy to do.

Huji updated the task description. (Show Details)Jun 7 2020, 1:21 AM