ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
[PMX:##] Re: ANSI colored output: How to determine how python was called?
by Fernando =?ISO-8859-1?Q?P=E9rez?= other posts by this author
May 21 2002 4:04PM messages near this date
[PMX:##] Re: string module | RE: Pythonwin and makepy problems
Pearu Peterson wrote:

> > colored text. And when you are trying to run colored text through pagers
> > like more/less, a whole new can of worms opens up!
>  
>  This can of worms is kept closed by using sys.stdout.isatty(). Try:
>  
>    python -c "import sys;print sys.stdout.isatty()"  | less
>  

Ah, but I _want_ to run colored text through a pager. And a well configured 
recent version of less can do it beautifully (under linux), though 'more' 
gets totally confused.

My approach  has been to document it in IPython and make it an option which is 
off by default. The users can test, and if it works for them they can turn it 
on. When it works it's great: you get syntax highlighted source code 
printouts for all your code objects from within ipython.

Cheers,

f.
-- 
http://mail.python.org/mailman/listinfo/python-list

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved