I have a python configuration script, the problem occurs when I import readline library and enter the console of the device. I get the input from the user this way:
val = input(display_str).strip()
This piece of code works perfectly but in the console of the device, long strings are not formatted properly and looks like it puts a limitation how long the string is and prints then on top of each-other. This makes the string unreadable and looks like this:
D/E,GATEWAY or N to delete : in format A:B:C:D:E:F:G:H/K,GATEWAY A:A:B:B:C:C:D:D
when in reality it needs to be formatted like this:
Enter eth1 IPv6 static routes in format A:B:C:D:E:F:G:H/K,GATEWAY A:A:B:B:C:C:D:D/E,GATEWAY or N to delete :
The formatting works perfectly when I ssh or use monitor but when I connect with console it mixes. When I remove the library everything works smoothly.
I found another solution to this problem which is using:
sys.stdout.write(display_str)
val = input().strip()
However here another problem occurs, the user can move left to the beginning of the string and delete the display_str and is not suitable. Other than then it works normally in every mode. Is there a solution for the input function or for the sys.stdout