[IPython-user] IPython demo mode and Windows---coloring problem
Fernando Perez
Fernando.Perez at colorado.edu
Sat Jan 14 00:22:32 CST 2006
Travis E. Oliphant wrote:
> I just finished using IPython to demo the new NumPy and SciPy using the
> very nice demo module in IPython. Unfortunately, I had to use WinXP.
Great, glad it worked! That code was written on the plane to scipy'05, after
scribbling the idea at the airport waiting room, so it's not exactly
industrial-strength :) John wanted to make some matplotlib demos and I thought
something like this would be cool. I did polish it a bit later, but it's
still very raw, so by all means complain if you see limitations (that can be
fixed: don't ask about stop points in nested indents; that is pretty much
impossible).
> The first thing I noticed, is that while my terminal window is colored
> nicely, the terminal did not understand the coloring codes for the demo
> classes code parser.
>
> Is this a known problem. I realize Windows terminals are not
> ANSI-friendly, but I thought that because I could see colors in the
> prompt, other colors would work too.
>
> Of course
>
> %colors NoColor
>
> worked fine, but it definitely wasn't as snazzy as it seemed on my Linux
> box.
>
> I even tried installing ANSI.COM (and tried enabling ANSI.SYS in the
> CONFIG.NT file) --- all to no avail.
>
> Is this expected behavior? and/or does anybody see a fix?
Ummh, I don't really know for sure. I thought that even under win32, at least
the syntax highlighting from ?? would work. What happens if you type for example
import code
code.softspace??
Does the shown source code come up with colors, or not? The mechanism used to
highlight source in the Demo class is the same as that used for code
colorization in 'foo??', given in the IPython.PyColorize module. What happens
if you type
%pycat code
Note that if you are using the official 0.7.0 and not SVN, a little bug in
%pycat requires this trivial patch (change colorize -> pycolorize):
abdul[contrib]> cat pycat-fix.patch
=== modified file 'IPython/Magic.py'
--- IPython/Magic.py
+++ IPython/Magic.py
@@ -2735,7 +2735,7 @@
to be Python source and will show it with syntax highlighting. """
filename = get_py_filename(parameter_s)
- page(self.shell.colorize(file_read(filename)),
+ page(self.shell.pycolorize(file_read(filename)),
screen_lines=self.shell.rc.screen_length)
# end Magic
I know the win32 console is riddled with problems, but at least I thought we
had the coloring working. Could you try using a cygwin bash terminal? I
believe that one works fine.
Perhaps our win32 experts may be able to pitch in with help as well...
Cheers,
f
More information about the IPython-user
mailing list