This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

ANSI escapes in Python with Cygwin


Hi,

Perhaps I missed something somewhere but...

I can make the same escape sequences to make color (bold...) text in Python
and Bash when under Linux.

This don't work with Cygwin: only bash ANSI escape sequences are equivalent
on Cygwin and Bash/Linux.

In example:

[bash]python

>>> RED = chr(27) + '[31m'
>>> print RED + 'hello world in red'
<-[31mhello world in red

The escape character is printed as a left arrow (1 character cell) and the
ANSI code is printed !
The color of the text does not turn to red.

Notes :

1/ I did not test the same in perl but I guess it should be identical.
2/ I tested this with both "official" binary distributions (1.5.2 and 2.0)
of Python for Windows.

Did I miss something or should I do something else to get it at work.

Thanks in advance for some light

Gilles Lenfant


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]