IPython colors in windows

A

Ashot

I am using IPython in windows and the LightBG setting doesn't correctly
because the background of the text is black even if the console background
is white. Anyone know whats going on? Thanks.

--
==============================
Ashot Petrosian
University of Texas at Austin, Computer Sciences
(views expressed are solely my own)
==============================
 
J

James

Ashot said:
I am using IPython in windows and the LightBG setting doesn't correctly
because the background of the text is black even if the console background
is white. Anyone know whats going on? Thanks.

--
==============================
Ashot Petrosian
University of Texas at Austin, Computer Sciences
(views expressed are solely my own)
==============================

Did you try installing readline for windows?
http://newcenturycomputers.net/projects/readline.html
 
A

Ashot

Did you try installing readline for windows?
http://newcenturycomputers.net/projects/readline.html

yea I've installed that and ctypes. The color and tab completion work,
its just that colored get displayed with black background, it almost works
so its very frustrating..

--
==============================
Ashot Petrosian
University of Texas at Austin, Computer Sciences
(views expressed are solely my own)
==============================
 
D

DogWalker

Ashot said:
yea I've installed that and ctypes. The color and tab completion work,
its just that colored get displayed with black background, it almost works
so its very frustrating..

Did you try the following (from the manual)?:

Input/Output prompts and exception tracebacks


You can test whether the colored prompts and tracebacks work on your system interactively by typing '%colors Linux' at the prompt (use '%colors LightBG' if your terminal has a light background). If the input prompt shows garbage like:
[0;32mIn [[1;32m1[0;32m]: [0;00m
instead of (in color) something like:
In [1]:
this means that your terminal doesn't properly handle color escape sequences. You can go to a 'no color' mode by typing '%colors NoColor'.


You can try using a different terminal emulator program. To permanently set your color preferences, edit the file $HOME/.ipython/ipythonrc and set the colors option to the desired value.
 
F

Fernando Perez

Ashot said:
I am using IPython in windows and the LightBG setting doesn't correctly
because the background of the text is black even if the console background
is white. Anyone know whats going on? Thanks.

It's quite possible that it's a bug in the UNC readline implementation proper.
How do you set the background to white? Is this something that can be done for
the normal winxp terminal, or do you use a different terminal emulator?

I'd like to have more detailed info before I contact the readline author. He's
done a great job of providing ANSI-compliant color escape handling for the
piece of junk which MS ships as a terminal, but it's quite possible that he may
have missed something for the case of light backgrounds.

Regards,

f (ipython author)
 
A

Ashot

yea, I've done that. It must be something subtle, as the colors and tab
completion works.
Ashot said:
yea I've installed that and ctypes. The color and tab completion work,
its just that colored get displayed with black background, it almost
works
so its very frustrating..

Did you try the following (from the manual)?:

Input/Output prompts and exception tracebacks


You can test whether the colored prompts and tracebacks work on your
system interactively by typing '%colors Linux' at the prompt (use
'%colors LightBG' if your terminal has a light background). If the input
prompt shows garbage like:
[0;32mIn [[1;32m1[0;32m]: [0;00m
instead of (in color) something like:
In [1]:
this means that your terminal doesn't properly handle color escape
sequences. You can go to a 'no color' mode by typing '%colors NoColor'.


You can try using a different terminal emulator program. To
permanently set your color preferences, edit the file
$HOME/.ipython/ipythonrc and set the colors option to the desired value.



--
==============================
Ashot Petrosian
University of Texas at Austin, Computer Sciences
(views expressed are solely my own)
==============================
 
C

Claudio Grondi

Hi,

I have watched this thread hoping to get an
hint on my problem, but it seems I didn't.

My problem is, that the background of part of
the error messages is always black
(e.g. after typing In [1]: sdfsdf)
and my monitor failes to show the red, green
texts on black background clearly enough
to see it (I can read it after selection, which
inverts the colors).
I have tried to play with PyColorize.py,
LightBGColors = ColorScheme(
'LightBG',{
token.NUMBER : Colors.Cyan,
token.OP : Colors.Blue,
token.STRING : Colors.Blue,
tokenize.COMMENT : Colors.Red,
token.NAME : Colors.White, # Colors.Black,
token.ERRORTOKEN : Colors.Red,

_KEYWORD : Colors.Green,
_TEXT : Colors.Blue,

'normal' : Colors.White # Colors.Normal # color off (usu.
Colors.Normal)
}
but without success.
How can I get rid of the black background
"---------------------------------------------------------------------------
"
"exceptions.NameError" Traceback (most
recent call last)
in with quotation marks marked areas?
Where is the color of the background of this
areas defined?
The color scheme seems to handle only the
text colors, not the background.

Claudio

Ashot said:
yea, I've done that. It must be something subtle, as the colors and tab
completion works.
Ashot said:
Ashot wrote:
I am using IPython in windows and the LightBG setting doesn't
correctly
because the background of the text is black even if the console
background
is white. Anyone know whats going on? Thanks.

--
==============================
Ashot Petrosian
University of Texas at Austin, Computer Sciences
(views expressed are solely my own)
==============================

Did you try installing readline for windows?
http://newcenturycomputers.net/projects/readline.html


yea I've installed that and ctypes. The color and tab completion work,
its just that colored get displayed with black background, it almost
works
so its very frustrating..

Did you try the following (from the manual)?:

Input/Output prompts and exception tracebacks


You can test whether the colored prompts and tracebacks work on your
system interactively by typing '%colors Linux' at the prompt (use
'%colors LightBG' if your terminal has a light background). If the input
prompt shows garbage like:
[0;32mIn [[1;32m1[0;32m]: [0;00m
instead of (in color) something like:
In [1]:
this means that your terminal doesn't properly handle color escape
sequences. You can go to a 'no color' mode by typing '%colors NoColor'.


You can try using a different terminal emulator program. To
permanently set your color preferences, edit the file
$HOME/.ipython/ipythonrc and set the colors option to the desired value.



--
==============================
Ashot Petrosian
University of Texas at Austin, Computer Sciences
(views expressed are solely my own)
==============================
 
F

Fuzzyman

Are you really using the readline module from newcenturycomputers ?
I've got a feeling that's broken and you need to use the Gary Bishop
one with IPython....

Sorry if this is spurious... (restricted internet access, so I can't
check for you... but the correct one is linked to from the IPython
site).

Regards,

Fuzzy
http://www.voidspace.org.uk/python/index.shtml

Claudio said:
Hi,

I have watched this thread hoping to get an
hint on my problem, but it seems I didn't.

My problem is, that the background of part of
the error messages is always black
(e.g. after typing In [1]: sdfsdf)
and my monitor failes to show the red, green
texts on black background clearly enough
to see it (I can read it after selection, which
inverts the colors).
I have tried to play with PyColorize.py,
LightBGColors = ColorScheme(
'LightBG',{
token.NUMBER : Colors.Cyan,
token.OP : Colors.Blue,
token.STRING : Colors.Blue,
tokenize.COMMENT : Colors.Red,
token.NAME : Colors.White, # Colors.Black,
token.ERRORTOKEN : Colors.Red,

_KEYWORD : Colors.Green,
_TEXT : Colors.Blue,

'normal' : Colors.White # Colors.Normal # color off (usu.
Colors.Normal)
}
but without success.
How can I get rid of the black background
"---------------------------------------------------------------------------
"
"exceptions.NameError" Traceback (most
recent call last)
in with quotation marks marked areas?
Where is the color of the background of this
areas defined?
The color scheme seems to handle only the
text colors, not the background.

Claudio

Ashot said:
yea, I've done that. It must be something subtle, as the colors and tab
completion works.
"Ashot" <[email protected]> said:



Ashot wrote:
I am using IPython in windows and the LightBG setting doesn't
correctly
because the background of the text is black even if the console
background
is white. Anyone know whats going on? Thanks.

--
==============================
Ashot Petrosian
University of Texas at Austin, Computer Sciences
(views expressed are solely my own)
==============================

Did you try installing readline for windows?
http://newcenturycomputers.net/projects/readline.html


yea I've installed that and ctypes. The color and tab completion work,
its just that colored get displayed with black background, it almost
works
so its very frustrating..


Did you try the following (from the manual)?:

Input/Output prompts and exception tracebacks


You can test whether the colored prompts and tracebacks work on your
system interactively by typing '%colors Linux' at the prompt (use
'%colors LightBG' if your terminal has a light background). If the input
prompt shows garbage like:
[0;32mIn [[1;32m1[0;32m]: [0;00m
instead of (in color) something like:
In [1]:
this means that your terminal doesn't properly handle color escape
sequences. You can go to a 'no color' mode by typing '%colors NoColor'.


You can try using a different terminal emulator program. To
permanently set your color preferences, edit the file
$HOME/.ipython/ipythonrc and set the colors option to the desired
value.



--
==============================
Ashot Petrosian
University of Texas at Austin, Computer Sciences
(views expressed are solely my own)
==============================
 
A

Ashot

this is what it looks like:

http://www.freshraisins.com/sand/ipythonscreen.PNG

does cygwin have a readline utility in it? Perhaps this is overriding the
correct one? Thats the only thing I can think of.

..a

I have installed version 1.8. It makes is even worse,
because now also "In [1]:" gets black background
and is unreadable (it had a grey background before).
Re-installing 1.7 makes the background again
gray. I use German Windows 2000 SP 4 as OS.

Claudio
P.S. In quote marks the parts with black background:
"In [1]:" sdlfjf
"---------------------------------------------------------------------------
"
"exceptions.NameError" Traceback (most
recent call last)


Fernando Perez said:
Try version 1.8, some coloring problems have been recently fixed. If
that
doesn't do it, let me know and I'll try to get in touch with the author
to see
if he can help.

Cheers,

f



--
==============================
Ashot Petrosian
University of Texas at Austin, Computer Sciences
(views expressed are solely my own)
==============================
 
C

Claudio Grondi

I have installed version 1.8. It makes is even worse,
because now also "In [1]:" gets black background
and is unreadable (it had a grey background before).
Re-installing 1.7 makes the background again
gray. I use German Windows 2000 SP 4 as OS.

Claudio
P.S. In quote marks the parts with black background:
"In [1]:" sdlfjf
"---------------------------------------------------------------------------
"
"exceptions.NameError" Traceback (most
recent call last)
 
F

Fernando Perez

Ashot said:
this is what it looks like:

http://www.freshraisins.com/sand/ipythonscreen.PNG

does cygwin have a readline utility in it? Perhaps this is overriding the
correct one? Thats the only thing I can think of.

Hi folks,

could you please test under windows the 1.9 version of readline?

http://sourceforge.net/project/showfiles.php?group_id=82407&package_id=84552&release_id=302513

This was just put up a moment ago by the developer, let me know if it fixes
these problems.

Cheers,

f
 
F

Fernando Perez

Fernando said:
Hi folks,

could you please test under windows the 1.9 version of readline?

http://sourceforge.net/project/showfiles.php?group_id=82407&package_id=84552&release_id=302513

This was just put up a moment ago by the developer, let me know if it fixes
these problems.

Never mind. He contacted me briefly after I wrote this, with the following
info:

####################################

I just checked. The new version does not fix that problem. The code as
released does not handle backgrounds other than black. Folks should run
with a black background for now.

####################################

So for now, I'm sorry to say this but under win32, ipython users should stick
to dark backgrounds. I'll post a note here when the readline developer has a
chance to work on this problem.

Regards,

f
 
A

Ashot

whoa, that was quick, looks like it works for me. Thanks a lot!
It would be nice to be able to set the colors in the prefs file, although
its possible to edit the pyColorize file as Claudio mentioned.

..a

OK, make that 1.10:

http://sourceforge.net/project/shownotes.php?release_id=302526

Gary specifically targeted the light background problems with this one,
so
please report here if the whole thing gets fixed.

Regards,

f



--
==============================
Ashot Petrosian
University of Texas at Austin, Computer Sciences
(views expressed are solely my own)
==============================
 
A

Ashot

One more thing I was wondering about: why not highlight the source code in
the errors since you already have this functionality (with '??' command).
It would be nice to have it highlighed on the prompt as well, but I
imagine this may be more difficult.. I've been using IPython for about a
week and thats one of the two things I miss..

..a
OK, make that 1.10:

http://sourceforge.net/project/shownotes.php?release_id=302526

Gary specifically targeted the light background problems with this one,
so
please report here if the whole thing gets fixed.

Regards,

f



--
==============================
Ashot Petrosian
University of Texas at Austin, Computer Sciences
(views expressed are solely my own)
==============================
 
F

Fernando Perez

Ashot said:
One more thing I was wondering about: why not highlight the source code in
the errors since you already have this functionality (with '??' command).
It would be nice to have it highlighed on the prompt as well, but I
imagine this may be more difficult.. I've been using IPython for about a
week and thats one of the two things I miss..

On the input line, there's no way: ipython only gets what you type when you hit
return. It would require writing a full-blown IDE to get that.

For the errors, it's a bit tricky because I'd have to use the tokenization code
right inside the exception traceback builder. That's not particularly easy,
esp. considering that the traceback handler doesn't necessarily have full code
objects. Tokenizing a chunk of code which may begin half-way through a
function, with possibly an open triply-quoted multiline string in the middle,
can get tricky.

I'm not saying it's impossible, but it's certainly not a very straightforward
task. I simply haven't found it to be a priority, given that other parts of
ipython need a lot more work. Heck, those tracebacks are already miles ahead
of what you get from plain python (try 'xmode verbose' for real detailed
info), so for now I'm willing to leave them as they are.

But since it's definitely something which would be a nice improvement, I'll
gladly accept any patches which implement it in a clean, robust way.

Regards,

f
 
F

Fernando Perez

Ashot said:
whoa, that was quick, looks like it works for me. Thanks a lot!
It would be nice to be able to set the colors in the prefs file, although
its possible to edit the pyColorize file as Claudio mentioned.

Yes, I haven't implemented user-definable color schemes. Not impossible, but
not a priority at the moment (much bigger fish to fry). Sorry 'bout that
(patches welcome, though).

Regards,

f
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,219
Messages
2,571,117
Members
47,730
Latest member
scavoli

Latest Threads

Top