Reputation: 1546
Every time I run my python script in VScode I get the following lines printed in the terminal:
Microsoft Windows [Version 10.0.19041.630]
(c) 2020 Microsoft Corporation. All rights reserved.
E:\My Laptop\Coding\Python\Study files\Projects>C:/ProgramData/Anaconda3/Scripts/activate
(base) E:\My Laptop\Coding\Python\Study files\Projects>conda activate base
(base) E:\My Laptop\Coding\Python\Study files\Projects>C:/ProgramData/Anaconda3/python.exe "e:/My Laptop/Coding/Python/Study files/Projects/100_Clean.py"
than program executes normally. When execution ends, I get this line:
(base) E:\My Laptop\Coding\Python\Study files\Projects>
Why are these lines being printed? How can i turn them off in VSCode settings?
Upvotes: 1
Views: 4452
Reputation: 3
One of the above working solution seems to have been deprecated; you can adjust your vscode settings for"terminal.integrated.profiles.windows":
example:
"Command Prompt": {
"path": ["C:\\WINDOWS\\System32\\cmd.exe"],
"args": ["/K", "prompt $G$S "], }
Upvotes: 0
Reputation: 1234
The most convenient way is to edit your user settings.json
like so
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
"terminal.integrated.shellArgs.windows": ["/K", "prompt $G"],
Now my integrated terminal looks like so
>C:/Users/guido/miniconda3/Scripts/activate
(base) >conda activate condavenv
(condavenv) >
Alternatively, you can look for Code Runner extension in the marketplace - which has the option to do exactly what you want: only the output of the code is printed and nothing else.
Upvotes: 2
Reputation: 21
To my knowledge, there is no way to hide the paths because the VS Code Integrated Terminal is basically using your OS/system's underlying terminal. And running Python scripts on a terminal usually requires you to specify a path.
One workaround is to use "prompt" command in the same terminal window before running your code. Like this:
prompt $$
The other workaround is to use debug console as suggested by others.
Upvotes: 2
Reputation: 2441
(base) E:\My Laptop\Coding\Python\Study files\Projects>
isn't from your program, it is the area to type your command in the command prompt (in VS Code).
Upvotes: 0