Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29667
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Subject | Re: Seome kind of unblocking input |
| Date | 2012-09-21 15:54 -0400 |
| Organization | > Bestiaria Support Staff < |
| References | <0be9b4c2-b661-4709-ba8f-40a6f78ad634@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1030.1348257285.27098.python-list@python.org> (permalink) |
On Fri, 21 Sep 2012 02:13:28 -0700 (PDT), janis.judvaitis@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@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Seome kind of unblocking input janis.judvaitis@gmail.com - 2012-09-21 02:13 -0700
Re: Seome kind of unblocking input Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-21 15:54 -0400
Re: Seome kind of unblocking input Ramchandra Apte <maniandram01@gmail.com> - 2012-09-23 08:49 -0700
Re: Seome kind of unblocking input Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-23 18:13 +0100
Re: Seome kind of unblocking input Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-23 13:50 -0400
Re: Seome kind of unblocking input Ramchandra Apte <maniandram01@gmail.com> - 2012-09-23 22:31 -0700
Re: Seome kind of unblocking input Ramchandra Apte <maniandram01@gmail.com> - 2012-09-23 22:31 -0700
Re: Seome kind of unblocking input Chris Angelico <rosuav@gmail.com> - 2012-09-24 15:14 +1000
Re: Seome kind of unblocking input Ramchandra Apte <maniandram01@gmail.com> - 2012-09-23 08:49 -0700
Re: Seome kind of unblocking input janis.judvaitis@gmail.com - 2012-09-25 01:05 -0700
csiph-web