Page MenuHomePhabricator

No obvious way to know possible languages in pywikibot configuration
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • python pwb.py generate_user_files
  • Select family of sites we are working on, just enter the number or name (default: wikipedia): 1
  • The language code of the site we're working on: en

in this example the only valid language is 'commons' for 'commons'. The only way i found this was by checking 'pywikibot/families/commons_family.py'

What happens?:

  • The language code en is not in the list of known languages. Do you want to

continue? ([y]es, [N]o):

What should have happened instead?:

  • should list possible languages

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:
pywikibot core_stable as of Sept 23 2021

Event Timeline

This comment was removed by Xqt.

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

[pywikibot/core@master] [IMPR] Use \"site code\" instead of \"language\" in scripts message

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

Xqt triaged this task as Low priority.

What should have happened instead?:

  • should list possible languages

There is a difference between site code and it's language. Pywikibot uses the site code and family name to determine a site, e.g. commons has the family name "commons" and the site codes "commons", "beta" and "test" for 3 valid sites. All of them has "en" as their language, for example:

>>> import pywikibot
>>> site = pywikibot.Site('commons:beta')
>>> site.code
'beta'
>>> site.lang
'en'
>>> site = pywikibot.Site('commons:commons')
>>> site.code
'commons'
>>> site.lang
'en'

but a Site('commons:en') does not exist.

Change 723424 merged by jenkins-bot:

[pywikibot/core@master] [IMPR] Use \"site code\" instead of \"language\" in scripts message

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