for _filename in os.listdir(os.path.join(_base_dir,
'families')):
OSError: [Errno 2] No such file or directory:
'/home/username/.pywikibot/families'
Looks like you have compat in "/home/username/pywikipedia/compat/" but _base_dir is '/home/username/.pywikibot'
_base_dir is determined in the following order -
1. If the script was called with a -dir: argument, use the directory
provided in this argument
2. If the user has a PYWIKIBOT_DIR environment variable, use the value
of it
3. If the script was started from a directory that contains a
user-config.py file, use this directory as the base
4. If all else fails, use the directory from which this module was
loaded.
5. If the user-config.py file is not found, another will be created
in the current directory, following in the footsteps of project,
language and bot username.
To me you must make sure _base_dir will return "/home/username/pywikipedia/compat/", so it will find subdir families.