Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

ImportError: No module named 'lib.models.{model_name}' #2

Open
matak07 opened this issue Aug 25, 2019 · 0 comments
Open

ImportError: No module named 'lib.models.{model_name}' #2

matak07 opened this issue Aug 25, 2019 · 0 comments

Comments

@matak07
Copy link

matak07 commented Aug 25, 2019

While trying to run train.py, I got the following error:

Traceback (most recent call last):
File "train.py", line 33, in
main()
File "train.py", line 29, in main
model = load_model(opt, data)
File "/////codes/skip-ganomaly-master/lib/models/init.py", line 20, in load_model
model_lib = importlib.import_module(model_path)
File "/usr/lib/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 956, in _find_and_load_unlocked
ImportError: No module named 'lib.models.{model_name}'

I actually rectified it by changing a line in ./lib/models/init.py.
change:
model_path = "lib.models.{model_name}"
to:
model_path = "lib.models.{}".format(model_name)

And the codes start running. I just wanted to know if this is correct or is there any other solution.
Also, I am running this code on Python 3.5. Will that affect the functionality of the code?
Thanks. Any help appreciated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant