Seome kind of unblocking input

janis.judvaitis at gmail.com janis.judvaitis at gmail.com
Fri Sep 21 05:13:28 EDT 2012


Hello!

I'm building small console like program for embedded system control over serial port. Naturally I need to be able to recieve commands from user and print reply's from embedded device.

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.

Note 2: I've readed about ways to make nonblocking input by reading single char etc. but that's is all messy and very platform dependent, I would love to have platform independent solution.

Thanks in advance!

--JJ



More information about the Python-list mailing list