views:

92

answers:

1

When I try to run the python koans, I don't get the colors, instead I get the ANSI color codes. I want to get the colors. It seems to be using colorama under the hood. I try to run colorama sample code in the interpeter and get syntax errors and/or assert errors.

Second if can't fix first: How do I get to strip out the ansi color codes. I tried various values of strip=True, and Convert=False to no avail.

Please help.

A: 

Sorry about that!

The ansi colors are a very recent feature, and I haven't got around to adding a command line option to turn it off yet. Its coming very soon though!

In the meantime taking a slightly older version would get around the problem. Here's how you can do it through mercurial:

hg clone https://[email protected]/gregmalcolm/python_koans
hg update -r 80

and this should work for git:

git clone http://github.com/gregmalcolm/python_koans
git checkout -b nocolor a410591b5aaeec57a4a8

This is actually the first complaint I've had of the color not working. What OS/terminal are you running from?

Greg Malcolm
I am running Windows 7 Home Premium.
jvervoorn
I just pushed out a fix (in runner/sensei.py). Can you let me know if that fixed it for you you?
Greg Malcolm
Sorry it took so long to write back, was with wife at her sisters house. Her sister just had 2 surgeries back to back. Well Anyway, back at my computer, and can try again.
jvervoorn
I can run from command line, but from idle I get an assertion error.
jvervoorn
Don't know if I can paste the whole message: Traceback (most recent call last): File "C:\Users\John\Downloads\python_koans-tip\python_koans-tip\python 3\contemplate_koans.py", line 25, in <module> Mountain().walk_the_path(sys.argv) .......... File "C:\Users\John\Downloads\python_koans-tip\python_koans-tip\python 3\libs\colorama\winterm.py", line 68, in set_console win32.SetConsoleTextAttribute(handle, attrs) File "C:\Users\John\Downloads\python_koans-tip\python_koans-tip\python 3\libs\colorama\win32.py", line 66, in SetConsoleTextAttribute assert successAssertionError
jvervoorn
Ah, yeah, it probably doesn't work if you run it from IDLE; it was only ever designed to work from the command line prompt (cmd.exe). I guess I could probably make it IDLE friendly sometime by checking if colorama throws exceptions, and turning off colorama when this is the case. For now I'd suggest going ahead and editing the About files in IDLE, but executing contemplate_koans.py from the command prompt.
Greg Malcolm