"tests/python/vscode:/vscode.git/clone" did not exist on "81c7781b5f39775f4abb895ba32af36ba2d30f87"
Commit 517e061c authored by Kai Chen's avatar Kai Chen
Browse files

bug fix for config path

parent 7205c2b1
...@@ -77,11 +77,13 @@ class Config(object): ...@@ -77,11 +77,13 @@ class Config(object):
filename = osp.abspath(osp.expanduser(filename)) filename = osp.abspath(osp.expanduser(filename))
check_file_exist(filename) check_file_exist(filename)
if filename.endswith('.py'): if filename.endswith('.py'):
sys.path.append(osp.dirname(filename))
module_name = osp.basename(filename)[:-3] module_name = osp.basename(filename)[:-3]
if '.' in module_name: if '.' in module_name:
raise ValueError('Dots are not allowed in config file path.') 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) mod = import_module(module_name)
sys.path.pop(0)
cfg_dict = { cfg_dict = {
name: value name: value
for name, value in mod.__dict__.items() for name, value in mod.__dict__.items()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment