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.judvai...@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
> 
>         wlfr...@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
You can clear the buffer by calling file.flush()
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to