473,387 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

changing color on the command prompt

Hi,

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.

Thanks
Jul 18 '05 #1
2 6624
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.


You may want to look at ipython (http://ipython.scipy.org), which does that
(and much more).

best,

f
Jul 18 '05 #2
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?

Thanks

Peter Hansen <pe***@engcorp.com> wrote in message news:<3F***************@engcorp.com>...
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@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

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Shooter4Life8 | last post by:
Hi, I am having trouble figureing out the best way to open a command prompt then write lines to it in VB.NET. Currently I have this code, but it execute's too fast I think because Dim psi As...
9
by: Endless Story | last post by:
My last version of Python was 2.4, running smoothly on XP with path c: \Python24 - no need even to include this path in PATH; everything worked as it's supposed to at the command line. Just...
2
by: Gil_H | last post by:
Hi, I'm trying to run a script over unix on a remote machine. In order to automate it, the procedure requests the following: 1. Using SSH connection. 2. Operating a command on the remote...
4
by: =?Utf-8?B?WUlndWNoaQ==?= | last post by:
Hi , I want to run a batch file from the c# code. Every time i run the batch file command prompt is displayed. I do not want to show this command prompt. Is there any way to suppress the...
4
by: Peter Nimmo | last post by:
Hi, I am writting a windows application that I want to be able to act as if it where a Console application in certain circumstances, such as error logging. Whilst I have nearly got it, it...
3
by: kimiraikkonen | last post by:
Hi experts, I just want to ask a simple procedure of my simple form. My form has a input textbox and a button. I want this if you can help me: Application user types a command prompt command...
1
by: mohaakilla51 | last post by:
Alright guys, I am really new to C++, and I wanted to, as my first project, create a command prompt, that pretty much just looks and works like a normal command prompt, except that it has more...
7
by: Jwe | last post by:
Hi, I've written a program which has both a command line interface and Windows form interface, however it isn't quite working correctly. When run from command line with no arguments it should...
1
by: pramodkh | last post by:
Dear All, I am writting a PERL script in windows to test some test cases. The test result is captured both in command prompt and in the log file. But when the result is displayed on a windows...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.