473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Re: sys.ps1 with formatting (linux)

Hi all,

My apologies for resurrecting an old thread, but I couldn't find the
answer on the list and others might still have the same problem.

On Mon Jul 23 22:33:22 CEST 2007, Jon Dobson wrote (reformatted):
I'm trying to set sys.ps1 and sys.ps2 with some formatting using:

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.
After a couple of hours of having the same problem, I found out that you
should surround the unprintable characters with \001 and \002:

sys.ps1="\001\033[1m\033[32m\002spy>\001\033[0m\002"
sys.ps2="\001\033[1m\033[32m\002 .\001\033[0m\002"

Solution found in: http://hg.secdev.org/scapy/raw-file/tip/scapy.py:
^A and ^B delimit invisible caracters for readline to count right
Greetings,
Hugo
Aug 6 '08 #1
0 715

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: LRW | last post by:
OK, this is probably an odd, but esy question. =) I taught myself PHP from a Julie Meloni book and newsgroup questions. So, I don't think I've really learned the proper way of organizing and...
1
by: Tonguc Yumruk | last post by:
I'm trying to format an integer as money. As far as i can see there is no strfmon() in python. I also tried the locale.format("%.2f",100000000,True) way but it does not even made the grouping...
2
by: Konrad Koller | last post by:
Under Windows print formatting (header, footer etc.) is OK. Under LINUX it does not work. SciTEGlobal.properties state around line 352: # Printing - only works on Windows Why? How is print...
0
by: scooterm | last post by:
### Question Can anyone name a text editor or XML editor (prefer open source) that can open a simple table XML file in a spreadsheet-type GUI, without adding any extra formatting or junk to the...
7
by: Kayle | last post by:
For preservation of indentation when moving the C source file from Windows to Linux machine, what is the advice to format the code. Should the code formatted using spaces instead of tabs? When...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.