mirror of
https://github.com/clearml/clearml-session
synced 2025-01-31 02:46:56 +00:00
Fix defaultInterpreterPath in vscode
This commit is contained in:
parent
f86e897e7e
commit
5a7423069c
@ -379,6 +379,7 @@ def start_vscode_server(hostname, hostnames, param, task, env, bind_ip="127.0.0.
|
|||||||
)
|
)
|
||||||
|
|
||||||
if user_folder:
|
if user_folder:
|
||||||
|
# set user level configuration
|
||||||
settings = Path(os.path.expanduser(os.path.join(user_folder, 'User/settings.json')))
|
settings = Path(os.path.expanduser(os.path.join(user_folder, 'User/settings.json')))
|
||||||
settings.parent.mkdir(parents=True, exist_ok=True)
|
settings.parent.mkdir(parents=True, exist_ok=True)
|
||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
@ -404,6 +405,27 @@ def start_vscode_server(hostname, hostnames, param, task, env, bind_ip="127.0.0.
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# set machine level configuration
|
||||||
|
settings = Path(os.path.expanduser(os.path.join(user_folder, 'Machine/settings.json')))
|
||||||
|
settings.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
# noinspection PyBroadException
|
||||||
|
try:
|
||||||
|
with open(settings.as_posix(), 'rt') as f:
|
||||||
|
base_json = json.load(f)
|
||||||
|
except Exception:
|
||||||
|
base_json = {}
|
||||||
|
|
||||||
|
# noinspection PyBroadException
|
||||||
|
try:
|
||||||
|
# "python.defaultInterpreterPath" is a machine level setting
|
||||||
|
base_json.update({
|
||||||
|
"python.defaultInterpreterPath": sys.executable,
|
||||||
|
})
|
||||||
|
with open(settings.as_posix(), 'wt') as f:
|
||||||
|
json.dump(base_json, f)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
proc = subprocess.Popen(
|
proc = subprocess.Popen(
|
||||||
['bash', '-c',
|
['bash', '-c',
|
||||||
'{} --auth none --bind-addr {}:{} --disable-update-check {} {}'.format(
|
'{} --auth none --bind-addr {}:{} --disable-update-check {} {}'.format(
|
||||||
|
Loading…
Reference in New Issue
Block a user