+ 4
I need some Degugging colored table support?
This Colored Table By Vitya isn't working for me I use Windows and the Microsoft Visual Studio. https://code.sololearn.com/cy5t2Fcz6lrv/?ref=app
35 odpowiedzi
+ 2
ok, final try on this.
It's really about Windows cmd terminal's default behavior.
It can display color but something called VT100 have to be enabled first.
A post on stackoverflow have someone discovering that VT100 can be activated by adding this:
import os
os.system('')
I added these two lines to the top of Vitya's code and it worked.
But the colors are very bad. Not the same as Vscode's output. Maybe bad implementation by Windows.
Additional discussion here:
https:bugs.python.org/issue29059
As you can see, the solution the author gave is longer.
+ 11
When I wrote "not working", I meant that coloring lines of text wouldn't work in Sololearn playground. I tried this exact code in Linux terminal and had no problem running it. No errors, no additional modules, no imports and no problem what so ever.
The problem seems to be caused by lack of some module on the server side or limited functionality of the app. I wonder if there's a solution out there. I've seen a few codes like this one and they run without color either.
+ 10
Bionical Man, sorry for the delay, but let's face it — this method won't work in SL playground. Bob_Li is right. SL runs your code on their servers then they send the result to your simulated console. It's not a real console and it's limited in functionality.
However there are other ways to make nice looking output and other aspects of your game you can focus on. Just make a simple working version now. You can always add something later.
I'm gonna ask more experienced players on how they make their codes look fancy and support you as well 😉😉. Meanwhile I need to replace my dead phone battery. It popped from likestrorms 😄.
+ 3
Vitya I need your assistance answering this as you wrote the color table
+ 3
Bob_Li Windows CMD Console is that the Windows CMD prompt console. And so I do need to install vscode as vs is not what I need
+ 3
Vitya check out Bob_Li I think that may be a solution
+ 3
So wait you can right code In window cmd prompt terminal
+ 3
Bob_Li I still need to look into tweeking the vs terminal so I can get it to work there
+ 3
Vitya yah code works on Visual Studio Code Editor
+ 2
added ":" at the end of line 6 but it no go here Output
Traceback (most recent call last):
File "C:\Users\Vic\.conda\envs\env\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Vic\.conda\envs\env\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\debugpy\__main__.py", line 45, in <module>
cli.main()
File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\debugpy/..\debugpy\server\cli.py", line 430, in main
run()
File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\debugpy/..\debugpy\server\cli.py", line 267, in run_file
runpy.run_path(options.target, run_name=compat.force_str("__main__"))
File "C:\Users\Vic\.conda\envs\env\lib\runpy.py", line 267, in run_path
The thread 0x1 has exited with code 0 (0x0).
code, fname = _get_code_from_file(run_name, path_name)
File "C:\Users\Vic\.conda\envs\env\lib\runpy.py", line 242, in _get_code_from_file
code = compile(f.read(), fname, 'exec')
File "C:\Users\Vic\Desktop\door to freedom file collection\doortofreedom.py", line 7
s1="
^
SyntaxError: EOL while scanning string literal
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\debugpy\__main__.py", line 45, in <module>
cli.main()
File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\debugpy/..\debugpy\server\cl
+ 2
OK but what is the connection between doortofreedom.py and the Colored Table? Is one part of the other?
And do you get the error message when you run just the Colored Table code? I don't see how that could be.
At this point there's no way of telling where the issue lies without further information.
+ 2
In a new project on MICROSFT VISUAL STUDIO terminal i got this output.
[031m Hello World!
[0;30;40m 0;30;40 [0m[0;30;41m 0;30;41 [0m[0;30;42m 0;30;42 [0m[0;30;43m 0;30;43 [0m[0;30;44m 0;30;44 [0m[0;30;45m 0;30;45 [0m[0;30;46m 0;30;46 [0m[0;30;47m 0;30;47 [0m
[0;31;40m 0;31;40 [0m[0;31;41m 0;31;41 [0m[0;31;42m 0;31;42 [0m[0;31;43m 0;31;43 [0m[0;31;44m 0;31;44 [0m[0;31;45m 0;31;45 [0m[0;31;46m 0;31;46 [0m[0;31;47m 0;31;47 [0m
[0;32;40m 0;32;40 [0m[0;32;41m 0;32;41 [0m[0;32;42m 0;32;42 [0m[0;32;43m 0;32;43 [0m[0;32;44m 0;32;44 [0m[0;32;45m 0;32;45 [0m[0;32;46m 0;32;46 [0m[0;32;47m 0;32;47 [0m
[0;33;40m 0;33;40 [0m[0;33;41m 0;33;41 [0m[0;33;42m 0;33;42 [0m[0;33;43m 0;33;43 [0m[0;33;44m 0;33;44 [0m[0;33;45m 0;33;45 [0m[0;33;46m 0;33;46 [0m[0;33;47m 0;33;47 [0m
[0;34;40m 0;34;40 [0m[0;34;41m 0;34;41 [0m[0;34;42m 0;34;42 [0m[0;34;43m 0;34;43 [0m[0;34;44m 0;34;44 [0m[0;34;45m 0;34;45 [0m[0;34;46m 0;34;46 [0m[0;34;47m 0;34;47 [0m
[0;35;40m 0;35;40 [0m[0;35;41m 0;35;41 [0m[0;35;42m 0;35;42 [0m[0;35;43m 0;35;43 [0m[0;35;44m 0;35;44 [0m[0;35;45m 0;35;45 [0m[0;35;46m 0;35;46 [0m[0;35;47m 0;35;47 [0m
[0;36;40m 0;36;40 [0m[0;36;41m 0;36;41 [0m[0;36;42m 0;36;42 [0m[0;36;43m 0;36;43 [0m[0;36;44m 0;36;44 [0m[0;36;45m 0;36;45 [0m[0;36;46m 0;36;46 [0m[0;36;47m 0;36;47 [0m
[0;37;40m 0;37;40 [0m[0;37;41m 0;37;41 [0m[0;37;42m 0;37;42 [0m[0;37;43m 0;37;43 [0m[0;37;44m 0;37;44 [0m[0;37;45m 0;37;45 [0m[0;37;46m 0;37;46 [0m[0;37;47m 0;37;47 [0m
[1;30;40m 1;30;40 [0m[1;30;41m 1;30;41 [0m[1;30;42m 1;30;42 [0m[1;30;43m 1;30;43 [0m[1;30;44m 1;30;44 [0m[1;30;45m 1;30;45 [0m[1;30;46m 1;30;46 [0m[1;30;47m 1;30;47 [0m
[1;31;40m 1;31;40 [0m[1;31;41m 1;31;41 [0m[1;31;42m 1;31;42 [0m[1;31;43m 1;31;43 [0m[1;31;44m 1;31;44 [0m[1;31;45m 1;31;45 [0m[1;31;46m 1;31;46 [0m[1;31;47m 1;31;47 [0m
[1;32;40m 1;32;40 [0m[1;32;41m 1;32;41 [0m[1;32;42m 1;32;42 [0m[1
+ 2
I use Sololearn playground as a practice field or a place to work out a code and if it doesn't appear to work on Sololearn playground I also use the Decoder app I use. And if that doesn't work I know understand it's because they aren't actual terminals so I use the Visual Studio not the Visual Studio Code as an editor not a IDE. I imagine the problem is simple I am not using a python ide but code editor.
any suggestions on a good ide. here is the website about visual studio code
https://www.microsoft.com/en-ca/resilience/remote-development-solutions/?&ef_id=CjwKCAiAm7OMBhAQEiwArvGi3OPwFCGQ1_i_V-x32eVntiuO63zFenp9o4J2iD6SHMEXKnt8zH1dhxoCZbUQAvD_BwE:G:s&OCID=AID2201104_SEM_CjwKCAiAm7OMBhAQEiwArvGi3OPwFCGQ1_i_V-x32eVntiuO63zFenp9o4J2iD6SHMEXKnt8zH1dhxoCZbUQAvD_BwE:G:s&gclid=CjwKCAiAm7OMBhAQEiwArvGi3OPwFCGQ1_i_V-x32eVntiuO63zFenp9o4J2iD6SHMEXKnt8zH1dhxoCZbUQAvD_BwE
+ 2
if you're working in windows, support for colored text in cmd terminal is not so great.
Your example works fine in my vscode terminal, but does not work when I run it from Windows cmd console.
Using modules like colorama can get cmd to display color, though the colors are muddy and not quite the same.
+ 2
oh, yes, Vitya's code.
Been doing some Google searches. Perhaps you can tweak which terminal to use in Visual Studio.
https://devblogs.microsoft.com/visualstudio/say-hello-to-the-new-visual-studio-terminal/
Worth a try.
+ 2
@vita I know I have real Consol code software I use. I hope this now makes sense. I only us SL A
as a study tool not as a programming tool
+ 2
Vitya ok
+ 1
I did in a post as that is the only what I know how