PyTorch-StudioGAN
PyTorch-StudioGAN copied to clipboard
import utils.misc as misc: error solution
My system is linux, and when I use main.py, it calls config.py. When “import utils.misc as misc“ and so on, it will report an error. However, if you add an empty init.py under src/utils, there will be no error.
If someone has a similar issue related to import modules, the following command will be helpful.
import pathlib
import sys
import os
# the path of the directory containing this file
root_path = pathlib.Path(__file__).parent.resolve()
root_path = os.path.join(str(root_path), "../")
sys.path.append(root_path)