mirror of https://github.com/open-mmlab/mmcv.git
bug fix for config path
parent
7205c2b1d0
commit
517e061ca4
|
@ -77,11 +77,13 @@ class Config(object):
|
|||
filename = osp.abspath(osp.expanduser(filename))
|
||||
check_file_exist(filename)
|
||||
if filename.endswith('.py'):
|
||||
sys.path.append(osp.dirname(filename))
|
||||
module_name = osp.basename(filename)[:-3]
|
||||
if '.' in module_name:
|
||||
raise ValueError('Dots are not allowed in config file path.')
|
||||
config_dir = osp.dirname(filename)
|
||||
sys.path.insert(0, config_dir)
|
||||
mod = import_module(module_name)
|
||||
sys.path.pop(0)
|
||||
cfg_dict = {
|
||||
name: value
|
||||
for name, value in mod.__dict__.items()
|
||||
|
|
Loading…
Reference in New Issue