Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52794 > unrolled thread
| Started by | "David M. Welch" <david.m.welch@gmail.com> |
|---|---|
| First post | 2013-08-21 11:42 -0500 |
| Last post | 2013-08-21 11:42 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
Re: Raw_input with readline in a daemon thread makes terminal text disappear "David M. Welch" <david.m.welch@gmail.com> - 2013-08-21 11:42 -0500
| From | "David M. Welch" <david.m.welch@gmail.com> |
|---|---|
| Date | 2013-08-21 11:42 -0500 |
| Subject | Re: Raw_input with readline in a daemon thread makes terminal text disappear |
| Message-ID | <mailman.104.1377118050.19984.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
Hi all, This is an old thread, but I'm having the same behavior in my terminal when I run some code but kill the process in the terminal (Ctrl-C). The code has two prime suspects (from a simple google search): 1. Creates ssh port forward via the subprocess module (http://unix.stackexchange.com/questions/4740/screen-remote-login-failure-an d-disappearing-text) 2. Using the getpass module (raw_input?) Calling "$ reset" brings back the disappearing text, so I'm just wondering if this issue has been addressed and if so, what should I be doing that I'm not. Thank you, Dave W. Response to post: http://mail.python.org/pipermail/python-list/2009-October/554784.html I'm getting input for a program while it's running by using raw_input in a loop in separate thread. This works except for the inconvenience of not having a command history or the use of backspace etc. That can be solved by loading the readline module; however, it results in a loss of visible access to the terminal when the program ends: nothing is echoed to the screen and the history is invisible (although it is there - hitting return executes whatever should be there normally). The only way to get it back is to close the terminal and open a new one. Here is minimal code that reproduces the problem (python 2.5 on Linux): from threading import Thread import readline get_input = Thread(target=raw_input) get_input.setDaemon(True) get_input.start() If the thread is not set to daemon mode, there is no such problem (don't know why this makes a difference), but in the real program, it needs to be a daemon or it hangs the exit waiting for more input. Any suggestions appreciated. Thanks, John
Back to top | Article view | comp.lang.python
csiph-web