Last modified: 2014-11-09 17:49:21 UTC
The family file generator believes there is a language 'sw', but the writes a family class with two 'en' langs, which is invalid dict syntax. $ python ./generate_family_file.py https://www.semantic-mediawiki.org/wiki/ semantic-mw Generating family file from https://www.semantic-mediawiki.org/wiki/ ================================== api url: https://semantic-mediawiki.org/w/api.php MediaWiki version: 1.22.3 ================================== Determining other languages...sw There are 2 languages available. Do you want to generate interwiki links? This might take a long time. ([y]es/[N]o/[e]dit)y Loading wikis... * sw... downloaded * en... in cache Writing pywikibot/families/semantic-mw_family.py... $ cat pywikibot/families/semantic-mw_family.py # -*- coding: utf-8 -*- """ This family file was auto-generated by $Id: 185033971c163ea46b2b1904773b8c407069a4d0 $ Configuration parameters: url = https://www.semantic-mediawiki.org/wiki/ name = semantic-mw Please do not commit this to the Git repository! """ from pywikibot import family class Family(family.Family): def __init__(self): family.Family.__init__(self) self.name = 'semantic-mw' self.langs = { 'en': 'semanticweb.org', 'en': 'semantic-mediawiki.org', } def scriptpath(self, code): return { 'en': '', 'en': '/w', }[code] def version(self, code): return { 'en': u'1.20.2', 'en': u'1.22.3', }[code] It isnt quite invalid syntax, but it is dodgy. The family file 'works' because semantic-mediawiki.org is second in that list, and all supported version of python return the second entry with the same key. $ python2.6 pwb.py shell Welcome to the Pywikibot interactive shell! >>> import pywikibot >>> s = pywikibot.Site('en', 'semantic-mw') >>> s.family.langs {'en': 'semantic-mediawiki.org'} >>> { ... 'en': u'1.20.2', ... 'en': u'1.22.3', ... } {'en': u'1.22.3'}
While dodgy, it works correctly.