Dvorapa added a comment.
Issue is in your family file detection, because `os.path.expanduser("~")+'/.pywikibot/families'+"/"+family+".py"` gives `royalfamily.py`, not `royalfamily_family.py` I assume your folder structure is like this (in your user folder, often abbreviated as `~`): .pywikibot -- user_config.py -- families -- royalfamily_family.py You should use `os.path.expanduser('~') + '/.pywikibot/families/' + family + '_family.py'` instead. See: $ python Python 3.7.4 (default, Jul 16 2019, 07:12:58) [GCC 9.1.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> import pywikibot // no need to import in user_config.py >>> from pywikibot import config2 // no need to import in user_config.py >>> family = 'royalfamily' >>> mylang = 'en' >>> config2.register_family_file(family, os.path.abspath(os.path.expanduser("~")+'/.pywikibot/families')+"/"+family+".py") >>> pywikibot.Site(mylang, family) Traceback (most recent call last): File "/home/pavel/.local/lib/python3.7/site-packages/pywikibot/family.py", line 1017, in load mod = import_module(splitext(basename(family_file))[0]) File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked ModuleNotFoundError: No module named 'royalfamily' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/pavel/.local/lib/python3.7/site-packages/pywikibot/__init__.py", line 1237, in Site fam = Family.load(fam) File "/home/pavel/.local/lib/python3.7/site-packages/pywikibot/tools/__init__.py", line 1738, in wrapper return obj(*__args, **__kw) File "/home/pavel/.local/lib/python3.7/site-packages/pywikibot/family.py", line 1019, in load raise UnknownFamily('Family %s does not exist' % fam) pywikibot.exceptions.UnknownFamily: Family royalfamily does not exist >>> config2.register_family_file(family, os.path.abspath(os.path.expanduser("~")+'/.pywikibot/families')+"/"+family+"_family.py") >>> pywikibot.Site(mylang, family) APISite("en", "royalfamily") TASK DETAIL https://phabricator.wikimedia.org/T234135 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Dvorapa Cc: Dvorapa, Xqt, pywikibot-bugs-list, Seppl2013, Aklapper, Viztor, DannyS712, Wenyi, Tbscho, MayS, Mdupont, JJMC89, Altostratus, Avicennasis, mys_721tx, jayvdb, Dalba, Masti, Alchimista, Rxy
_______________________________________________ pywikibot-bugs mailing list pywikibot-bugs@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs