Seome kind of unblocking input
Ramchandra Apte
maniandram01 at gmail.com
Sun Sep 23 11:49:44 EDT 2012
More information about the Python-list mailing list
Sun Sep 23 11:49:44 EDT 2012
- Previous message (by thread): Seome kind of unblocking input
- Next message (by thread): Seome kind of unblocking input
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Saturday, 22 September 2012 01:24:46 UTC+5:30, Dennis Lee Bieber wrote: > On Fri, 21 Sep 2012 02:13:28 -0700 (PDT), janis.judvaitis at gmail.com > > declaimed the following in gmane.comp.python.general: > > > > > Since I'm using threads and pipes everything works ok, except that when i call input() there is no way that I could print something, is there any workaround for this?? > > > > > > Note: I don't need to catch any key's before enter or smtng, just be able to print while input() is waiting. I'm thinking that maybe there is a way for two threads to share one stdout, which should resolve this, but I can't make it work, since U can't pickle file like object(stdout) to pass it to other thread. > > > > > > > Confusion abounds... > > > > You don't have to "pickle file like object..." for it to be used by > > a Python THREAD... But your mention of pipes makes me think you are > > using subprocesses and/or multiprocessing modules. Threads run in a > > shared environment (you may need to put a lock around the file object so > > that only one thread at a time does the I/O on that object), but > > processes are independent memory spaces. > > > > However, you may also encounter OS specific behavior WRT > > stdout/stderr when they are connected to a console. The OS itself may > > block/buffer output when there is a pending input on the same console. > > -- > > Wulfraed Dennis Lee Bieber AF6VN > > wlfraed at ix.netcom.com HTTP://wlfraed.home.netcom.com/ You can clear the buffer by calling file.flush()
- Previous message (by thread): Seome kind of unblocking input
- Next message (by thread): Seome kind of unblocking input
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list