changing color on the command prompt

Hank soundwave56 at
Thu Aug 28 20:44:06 CEST 2003

Sorry I wasn't being clear enough.

I meant the prompt for Windows operating system C:>. And by error
messages i just mean printouts like
print "Error in Process"

If its just an environment variable, i should be able to change it,
print it out and change it back to the original color right?

Anyone know which variable i have to modify?


Peter Hansen <peter at> wrote in message news:<3F4D34C5.150FD96E at>...
> Hank wrote:
> > 
> > does anyone know how to change the foreground color of the command
> > prompt through python?
> > 
> > For example if i was printing out an error message, I would like it to
> > be red where the normal text color is white.
> The question is underspecified/unclear.
> 1. What operating system?
> 2. By "command prompt", do you just mean the console, where text appears,
> or do you really mean the *prompt* for the operating system, which under
> Linux is usually something like "[user at host]#" and which under Windows
> is usually something like "C:\>"?
> 3. Now you mention error messages... that implies you just mean changing
> the color of your program's output.
> If you mean the actual *prompt*, you need to change the right environment
> variable, which usually needs a separate script.
> If you mean the console text color, check the archives for the last couple
> of days for responses to a similar question (search for "ansi.sys" perhaps).
> -Peter

More information about the Python-list mailing list