Problems flushing output over Telnet Session

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • theJade
    New Member
    • Apr 2007
    • 5

    #1

    Problems flushing output over Telnet Session

    I'm currently running Python 2.5 on Windows 2003. I'm not sure if this is strictly a python issue but I was wondering if anyone has seen and/or knows how to fix this problem.

    From a linux system using an xterm terminal type, I telnet into the Windows box and execute 'python script.py'. script.py is simply a script that takes in user input using raw_input("prom pt: ") and prints what the user inputted onto the screen. However the prompt doesn't get printed onto the screen.

    I suspected the issue was with flushing the ouptut so I've tried the following hack:

    print "prompt: "
    sys.stdout.flus h()
    raw_input("").

    This works fine for this case, but I also in the future want to get tab completion to work and the above code will not issue a re-prompt when the user presses tab as the prompt value in raw_input is "".

    I then tried the -u option in python and this is also giving me funny formatting with newlines and such.

    Lastly, I've tried changing the terminal type of the telnet client to vt100 and it seems to work okay. However, I don't want to require someone to change their terminal type to get this to work.

    Does anyone know of a good solution for this? And also perhaps explain what's going on?

    Thanks!
Working...