Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


boostr.in questions - Question:Print colorized output - working from console but not from script


I have weird problem that I cannot put my finger on. There is a program that I use (and contribute from time to time) that has colorized console output. Everything worked great until I reinstalled Windows. Now I cannot get colorized output.

This is the script that is used for colorizing.

I have managed to narrow down the problem to, more or less, simple situation, but I have no idea what is wrong.

This is console prompt that works as expected (string test is printed in red):

Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.insert(0, r'c:\bin\SV\tea\src')
>>> from tea.console.color import cprint, Color
>>> cprint('test\n', Color.red)
test
>>>

    

I have weird problem that I cannot put my finger on. There is a program that I use (and contribute from time to time) that has colorized console output. Everything worked great until I reinstalled Windows. Now I cannot get colorized output.

This is the script that is used for colorizing.

I have managed to narrow down the problem to, more or less, simple situation, but I have no idea what is wrong.

This is console prompt that works as expected (string test is printed in red):

Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.insert(0, r'c:\bin\SV\tea\src')
>>> from tea.console.color import cprint, Color
>>> cprint('test\n', Color.red)
test
>>>

But when I run following script with same version of python I get output test but not in red color (there is no color, just default console color):

import sys
sys.path.insert(0, r'c:\bin\SV\tea\src')

from tea.console.color import cprint, Color
cprint('test\n', Color.red)

    The same setup worked before I reinstalled my system.
    I have checked, environment variables in interactive mode and script are the same.
    I have tried this in standard windows command prompt and Console, program that I usually use.
    OS in question is Windows 8 and before reinstall this was also used on Windows 8.
    Same code with same setup works at computer at work (Windows 7).
    I have Python 2.7 and Python 3.3 installed (as I did before). I have tried to run script with calling python interpreter directly (c:\Python27\python.exe) or with py -2, but it does not help.
    IPython and mercurial colorizes output as it should.

Any ideas what can I try to make this work?

asked Sep 13, 2013 in rauter by rajesh
edited Sep 12, 2013 by rajesh
0 votes
18 views



Related Hot Questions



Government Jobs Opening


...