Expected output:
$ python
Python 2.7.3 (default, Feb 27 2014, 19:58:35)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import pywikibot
pywikibot.Link("en:", pywikibot.Site("commons", "commons")).site
Site("en", "wikipedia")
pywikibot.Link("wikipedia:", pywikibot.Site("commons", "commons")).site
Site("en", "wikipedia")
In fact:
$ python
Python 2.7.3 (default, Feb 27 2014, 19:58:35)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import pywikibot
pywikibot.Link("en:", pywikibot.Site("commons", "commons")).site
Site("commons", "commons")
pywikibot.Link("wikipedia:", pywikibot.Site("commons", "commons")).site
Traceback (most recent call last):
File "<stdin>", line 1, in <module> File "pywikibot/page.py", line 3777, in site self.parse() File "pywikibot/page.py", line 3700, in parse newsite = pywikibot.Site(otherlang, familyName) File "pywikibot/__init__.py", line 528, in Site _sites[key] = __Site(code=code, fam=fam, user=user, sysop=sysop) File "pywikibot/site.py", line 1186, in __init__ BaseSite.__init__(self, code, fam, user, sysop) File "pywikibot/site.py", line 449, in __init__ % (self.__code, self.__family.name))
pywikibot.exceptions.NoSuchSite: Language commons does not exist in family wikipedia
Version: core-(2.0)
Severity: major