I open my VS Code, open my project folder and put my code to run a Python file in loop and I'm going to do other activities on the computer, the VS Code window is in the background.
But the code encounters an error, at this point I would like the Visual Studio Code window running this code overlay all other windows and appear on the screen with focus.
If I want to create a shortcut that I click and it opens VS Code directly in the project folder, I need to put the path of the VS Code executable and after them put the path of the project folder:
"C:\Users\Computador\AppData\Local\Programs\Microsoft VS Code\Code.exe" "C:\Users\Computador\Desktop\Python So I tried to use it:
import subprocess from time import sleep def main() -> None: while True: try: a = 1 b = 0 c = a/0 except: subprocess.Popen([r'"C:\Users\Computador\AppData\Local\Programs\Microsoft VS Code\Code.exe" "C:\Users\Computador\Desktop\Python']) break sleep(60) if __name__ == '__main__': main() But get this error:
PermissionError: [WinError 5] Access Denied How should I proceed to avoid this error?
Code.exe"(Popen takes a list of strings, rather than one string), and a missing double quote onPython'. Also the loop does not repeat. The code shown will always throw DivisionByZero and then the loop will break out and stop the function