create a folder with a name of one of the dialects, or base, that must contain a python file, e.g. test.py
in python, try to import omi: from omi.dialects import get_dialect
Result:
ModuleNotFoundError: No module named 'omi.dialects.base.test'
Reason:
the __import__ function gets confused because it searches in __path__ as well as the local path.
Solution:
Maybe do the dynamic import manually, for instance by replacing code in in dialects/__init__.py:
import os
from omi.dialects.base.register import get_dialect
path = os.path.dirname(__file__)
for d in os.listdir(path):
if os.path.isfile(os.path.join(path, d, 'dialect.py')):
module_name = 'omi.dialects.' + d + '.dialect'
__import__(module_name)
Steps to reproduce:
base
, that must contain a python file, e.g.test.py
omi
:from omi.dialects import get_dialect
Result:
ModuleNotFoundError: No module named 'omi.dialects.base.test'
Reason:
the
__import__
function gets confused because it searches in__path__
as well as the local path.Solution:
Maybe do the dynamic import manually, for instance by replacing code in in
dialects/__init__.py
: