PyTorch-StudioGAN icon indicating copy to clipboard operation
PyTorch-StudioGAN copied to clipboard

import utils.misc as misc: error solution

Open shizuguilai opened this issue 2 years ago • 1 comments

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.

shizuguilai avatar Jan 15 '23 09:01 shizuguilai

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)

mingukkang avatar Apr 18 '23 03:04 mingukkang