Python Forum
Visual Studio-remove Output clutter
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Visual Studio-remove Output clutter
#1
Hi all,
Fairly new to python and very new to visual studio.
I am running thru the linkedin tutorial on Python. He uses visual studio and I have most of it working but my output(terminal view) has much more clutter in it.
ie if the python code simply says print("hello") I would expect the output window to to display


Quote:hello

instead i get a whole bunch of paths making it quite difficult to see the actual output.
(note i have removed some of the text from the screen capture for simplicity)
Any ideas what I haven't configured correctly?

Quote:Windows PowerShell
Copyright © Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS Microsoft.PowerShell.Core\FileSystem::\\\Documents\Python-Exercises\Exercise Files> & C:/Users/symonds/AppData/Local/Microsoft/WindowsApps/python.exe "///Documents/Python-Exercises/Exercise Files/Ch2/helloworld_finished.py"
hello world!
PS Microsoft.PowerShell.Core\FileSystem::\\\Documents\Python-Exercises\Exercise Files>
Reply
#2
Can you show what output gets displayed? I also use VS Code, and I might be able to help. Show with all examples of code you have ran, and the output you get, with all their proper code tags
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
Reply
#3
This stuff is a one time thing when the terminal is opened. Compared to a lot of other terminals this is almost minimalist.
Output:
Windows PowerShell Copyright © Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https://aka.ms/pscore6
This is the prompt and it is normal for a terminal. Be thankful it collapsed the path somewhat.
Output:
PS Microsoft.PowerShell.Core\FileSystem::\\\Documents\Python-Exercises\Exercise Files>
If you hate the long prompt and don't mind not always knowing what directory you are in, you can do this in powershell
Output:
PS C:\\Users\sombody\Documents\Python\Musings> Function prompt {'>>> '} >>>
Reply
#4
(May-07-2020, 01:48 AM)mds Wrote: He uses visual studio and I have most of it working but my output(terminal view) has much more clutter in it.
Maybe you mix of Visual studio with VS Code,the latter is what you should use as it more gear and develop for Python.
As i can not look at content,but same author has Visual Studio Code for Web Developers,so there he use VS Code.

Has a setup tutorial here VS Code from start.
Powershell no way Hand ,i use cmder it's in a other league.
Reply
#5
Quote:Maybe you mix of Visual studio with VS Code,
ahh yes my bad, I tried to find a way to edit the original post (to add "code" to the title) but cant sorry. Yes this is VS code.

Quote:If you hate the long prompt and don't mind not always knowing what directory you are in, you can do this in powershell
ok tried that trick
Quote:Function prompt {'>>> '}
its better, I now get
Quote:>>> & C:/Users/symonds/AppData/Local/Microsoft/WindowsApps/python.exe "//ad.monash.edu/home/User094/symonds/Documents/Python-Exercises/Exercise Files/Ch2/helloworld_finished.py"
hello world!
>>>
Id still like to remove that long pre path

Ok so here is screen capture of my VSC screen compared to the instructors(tutorial).
I did notice now that he is on an apple. One of you mentioned a replacement for powershell so im wondering if its simply a problem of the output capture app/plugin whatever it is.
NOte that he is using debug console, but I have tried the others, terminal,output etc. all seem to be either blank or the same. Im not up to speed with VSC yet enough to understand the diff.

My screen:
[Image: 13ce7c91a419042fbe06ce3c67b66c92.png]
his screen, note the displayed output only displays the actual code output, no path.
[Image: 2110bf9bdb7e64ebc4567941246c01f1.png]

A little more digging.
So its printing this
Quote:& C:/Users/symonds/AppData/Local/Microsoft/WindowsApps/python.exe "//ad.monash.edu/home/User094/symonds/Documents/Python-Exercises/Exercise Files/Ch2/helloworld_finished.py"
before the actual codes output of
Quote:hello world!
and this after it
Quote:PS Microsoft.PowerShell.Core\FileSystem::\\ad.monash.edu\home\User094\symonds\Documents\Python-Exercises\Exercise Files>

with the help of "Function prompt {'>>> '}"
we only get
Quote:& C:/Users/symonds/AppData/Local/Microsoft/WindowsApps/python.exe "//ad.monash.edu/home/User094/symonds/Documents/Python-Exercises/Exercise Files/Ch2/helloworld_finished.py"
before the actual codes output of
Quote:hello world!
and this after it
Quote:>>>

which is better but still cluttered by the path and file being executed text.
Reply
#6
ok one more thing.
I haven't needed debugging as yet(ie breakpoints etc) as the code has not been that difficult. Having noted tho that that was what he was using I tried this again.

I selected "debug console" as my bottom window
I use the run debug button(top left)instead of the run file in terminal button top right as I have been.
The bottom window jumps from debug console to terminal and displays the same path clutter. Clicking on debug console again reveals blank empty window.

Perhaps this is closer to my problem?
Reply
#7
(May-08-2020, 01:14 AM)mds Wrote: which is better but still cluttered by the path and file being executed text.
Follow VS Code from start using Code Runner then have better and easy control of where to output code.
"code-runner.runInTerminal": false, now run code in output and not terminal.
Image example:
[Image: QKGIvk.png]
Reply
#8
Hi snippstat thanks for your input
I followed the "VS code from start" as you suggested.
There were a few things that looked different(possibly due to new version etc)but I think I managed the same outcome.

Quote:Follow VS Code from start using Code Runner then have better and easy control of where to output code.
"code-runner.runInTerminal": false, now run code in output and not terminal.

Looking at my screen capture
[Image: f14cd3eb0d29253d69ea5878c5abf862.png]
The fact the terminal chosen is "Code" and not powershell makes me think its running your system now.
However as you see the "path" is still predominating the output.
Looking at your screen capture its the same... the filename being run is displayed too, its just that you have a very short path and so its not so confusing.
Id be content if it just displayed the filename.
Can we get rid of the path preamble?

Im also not sure what the white text and UNC path not supported means.
It would help If I could solve that because at least then the "hello world" text ie the output would be the only white text after the green garbage and thus easy to view.

Some side effects of all this setup are:
1)The pull down menu backgrounds are all see thru now. I can't discern the menu items(text) from the text behind them.(I can't screen shot this)
2)I get a popup warning about intellicode now.
[Image: 2c13a639160d16e761ae0a6e551bc829.png]

So sorry to be a pain. 1 Step fwd 2 steps back Think
Reply
#9
To only get filename in output,change to this.
"php": "php",
"python": "$pythonPath $fileName",
"perl": "perl",
You have the long default path to python,if want to shorten it look at Python 3.8 (3.6-3.7) and pip installation under Windows
Then output will look as image or as this.
[Running] C:\Python38\python.exe hello.py
Hello world

[Done] exited with code=0 in 0.227 seconds
Enable and reload so language server works,it's so Autocomplete, jump-to-definition, error-checking...ect works.
Why Language Server?
Reply
#10
thanks snippsat,
I had replied to this earlier but the forum locked up and its lost..
In brief.

The see thru drop down windows was caused by palsticAB extension. I have disabled it and we are back to normal.

Im not sure exactly where you want me to put the code found under
"To only get filename in output,change to this."

Language server was restarted and all is good now.


I can see it would be better to install python elsewhere. These are work laptops given to us in a hurry last day before they sent us home for the lockdown.
So things are setup and put in certain places for remote backup and things I dont understand. I am limited to permissions etc. I will have a play.
For now I guess I will just have to put up with it.
I'ts just hard to believe in all this overly complicated VSC environment there is not a way to parse the output and remove such things. ahh well.

I even tried komodo yesterday (recommended by a different tutorial). While it was much easier to setup I still got the same output result... (UNC warnings and long path) :(
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to set PYTHONPATH in Visual Studio Code? aupres 5 3,775 Aug-15-2023, 03:51 PM
Last Post: snippsat
  how do I open two instances of visual studio code with the same folder? SuchUmami 3 816 Jun-26-2023, 09:40 AM
Last Post: snippsat
  Visual Studio Code NewPi 3 985 May-16-2023, 11:13 PM
Last Post: snippsat
  Visual Studio Code venv ibm_db error mesi1000 7 2,663 Nov-13-2022, 12:36 AM
Last Post: snippsat
  debugging help on Visual Studio Code mg24 12 1,901 Oct-02-2022, 12:18 AM
Last Post: mg24
  Problem with importing Python file in Visual Studio Code DXav 7 4,936 Jun-15-2022, 12:54 PM
Last Post: snippsat
  Visual Studio Code Intellisense for Imported Modules Not Working hockinsk 1 2,650 Apr-23-2022, 04:41 PM
Last Post: deanhystad
Photo Visual studio code unable to color syntax on python interpreter tomtom 4 6,689 Mar-02-2022, 01:23 AM
Last Post: tomtom
  compile error Visual Studio Code jamie_01 2 1,661 Jan-25-2022, 09:36 AM
Last Post: Larz60+
  Calling python from c++ in visual studio pdk5 0 2,129 May-24-2021, 10:18 AM
Last Post: pdk5

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020