Created
May 19, 2020 02:58
-
-
Save arafatamim/351d0c0630209716015bea1ef8d9a7d8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import json | |
import subprocess | |
from pathlib import Path | |
venv_path = subprocess.check_output("poetry env info --path".split()) | |
venv_path = venv_path.decode("UTF-8") | |
settings = dict() | |
Path(".vscode").mkdir(parents=True, exist_ok=True) | |
Path(".vscode/settings.json").touch() | |
with open(".vscode/settings.json", "r") as f: | |
settings = json.load(f) | |
settings["python.pythonPath"] = venv_path | |
with open(".vscode/settings.json", "w") as f: | |
json.dump(settings, f, sort_keys=True, indent=4) | |
print(json.dumps(settings, sort_keys=True, indent=4)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment