sys.ps1 with formatting (linux)

Jon Dobson jdobson at
Mon Jul 23 22:33:22 CEST 2007

I'm trying to set sys.ps1 and sys.ps2 with some formatting (linux) using:

python -i -c 'import sys; sys.ps1="\033[1m\033[32mspy>\033[0m";sys.ps2="\033[1m\033[32m   .\033[0m"'

I get the colored prompt(s) as you might expect, but I'm getting some strange behavior with wrapping.  Once the interactive command gets long enough to wrap, it wraps back to the same line (overwriting the beginning).  It doesn't break anything - the command gets interpreted correctly, it's just an ugly way to work.

What's even "cooler" is when I middle-mouse-paste a command and then try to edit the line, it moves up one line in the shell and prints the command I'm editing (minus the character I just deleted).  Once again, it's just a display issue - the commands still work.

I realize this is pretty obscure, but I'm just hoping someone else has seen and dealt with something like this...


The information contained in this message and its attachments is
confidential and proprietary to LAIKA, Inc.  By opening this email
or any of its attachments, you agree to keep all such information
confidential and not to use, distribute, disclose or copy any part
of such information without the prior written consent of LAIKA,
Inc.  If you are not the intended recipient of this message, any use,
distribution, disclosure or copying of such information is prohibited.
If received in error, please contact the sender. 

More information about the Python-list mailing list