3

I have a python program which prints long outputs. When i try to run that file in vscode, its interactive window isn't enough to view full output. So is there any way to run python file in cmd from VSCODE?

1
  • If you find my answer helpful you could generalize is post better by getting rid of the vscode part. Post title could be "How to run python script in windows cdm prompt to read long outputs?" If you are determined to use vs code, that's another story, and good luck. Commented Mar 27, 2019 at 17:07

2 Answers 2

7

If you are running windows, VSCode uses Powershell as your terminal by default. If you want to use the command prompt instead, hit ctrl+shift+p, type Shell into the command pallet, select Terminal: Select Default Shell, and change it to Command Prompt. I am not sure this will fix your problem as I think Powershell should display just as much output as the CMD, but if you want to try switching terminals, that will do it. Another option is to try to run it natively in CMD or Powershell, rather than using the VSCode integrated terminal. That might be better if changing terminals doesn't help.

Sign up to request clarification or add additional context in comments.

Comments

0

As @Jeremiah said, you can also just run your script with the Cmd prompt, without using vs code. Let's say you have the file 'test1.py' saved as C:\Users\bcubrich\Documents\test1.py, and your python env .exe is saved in C:\python27\ArcGIS10.5\python.exe. I just wrote script that had this in it:

print('worked')

Then just input this into the Cmd prompt

C:\python27\ArcGIS10.5\python.exe C:\Users\bcubrich\Documents\test1.py

And it printed

worked

to the console.

More on running python through cmd console here: http://www.cs.bu.edu/courses/cs108/guides/runpython.html

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.