user-config.py
# -*- coding: utf-8 -*- import os family = 'royalfamily' register_family_file(family, os.path.abspath(os.path.expanduser("~")+'/.pywikibot/families')+"/"+family) mylang = 'en' usernames[family]['en'] = u'wf' console_encoding = 'utf-8' password_file = "wf-password.py"
migrate.py
#!/usr/bin/python # -*- coding: utf-8 -*- import pywikibot mysite = pywikibot.Site() print(mysite.sitename)
python3 migrate.py Traceback (most recent call last): File "migrate.py", line 4, in <module> mysite = pywikibot.Site() File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pywikibot/__init__.py", line 1237, in Site fam = Family.load(fam) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pywikibot/tools/__init__.py", line 1738, in wrapper return obj(*__args, **__kw) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pywikibot/family.py", line 1008, in load raise UnknownFamily('Family %s does not exist' % fam) pywikibot.exceptions.UnknownFamily: Family royalfamily does not exist CRITICAL: Exiting due to uncaught exception <class 'pywikibot.exceptions.UnknownFamily'>
alternatively try
family_files[family] = 'http://royal-family.bitplan.com/'
to get
WARNING: /opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pywikibot/site.py:774: UserWarning: Global configuration variable "mylang" changed to "royalfamily" while instantiating site royalfamily:royalfamily % (self.__code, self), UserWarning) WARNING: migrate.py:4: UserWarning: Site royalfamily:royalfamily instantiated using different code "en" mysite = pywikibot.Site() royalfamily:royalfamily
none of this makes sense to me and i commented on the other phabricator tasks with similar issues that the documentation and the experience seems to be inconsistent.