1

So I need to use Python for my work. Unfortunately, since recent hacks, the companies security policies are very strict and there is no way I'm getting admin rights. I managed to persuade our IT to install Python, Visual Studio Code, and the Python extension for it on my computer.

If I try to run python commands in the Python interpreter it works. But when I try to run a Python script in Visual Studio Code it hast to run Power Shell which is also blocked for security reasons. I get the following error:

The terminal process command 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe' failed to launch (exit code: {2})

Is there some way around this? To use Python in Visual Studio Code despite all of the security restrictions?

I tried asking our IT department but they have no idea how to help me...

Thank you in advance.

1
  • 1
    I would escalate that up to your manager. There is no way that IT should stop anyone working. Commented Jan 19, 2021 at 10:35

2 Answers 2

2

You can change the VS Code settings and tell it to not use PowerShell as shell in the integrated terminal.

For example, I have put Windows Terminal in there, but you can also use CMD or any other shell such a git bash as long as it's available in your system.

Press ctrl+shift+p and type/select Open Settings (JSON). Then add some of the following to this configuration file, and save.

For Windows Terminal:

"terminal.external.windowsExec": "C:\\Users\\<your-username>\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe"

For CMD:

"terminal.external.windowsExec": "C:\\Windows\\system32\\cmd.exe"
Sign up to request clarification or add additional context in comments.

2 Comments

I love the simplicity of this solution but it's not working for me despite having followed the instructions to the letter :^(
Sorry, I just realized the solution applied to external windows. I was looking for a solution to the integrated terminal. If so, the json code is "terminal.integrated.defaultProfile.windows": "Command Prompt" Works fine.
2

I'm used below code in setting file and it works.

"terminal.integrated.defaultProfile.windows": "Command Prompt"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.