Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'output': 0.04; 'missed': 0.09; 'python': 0.09; 'modules.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'sep': 0.09; 'thread': 0.11; 'confusion': 0.16; 'did.': 0.16; "key's": 0.16; 'object),': 0.16; 'pipes': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'thread.': 0.16; 'threads': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'input': 0.18; 'memory': 0.18; 'pending': 0.20; 'work,': 0.22; '(you': 0.23; 'mention': 0.23; 'connected': 0.24; 'pass': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'updating': 0.27; 'header:X-Complaints-To:1': 0.28; 'run': 0.28; 'environment': 0.29; 'i/o': 0.29; 'pickle': 0.29; 'piece': 0.29; 'workaround': 0.29; "i'm": 0.29; 'maybe': 0.29; 'fri,': 0.30; 'lists': 0.31; 'file': 0.32; 'from:addr:yahoo.co.uk': 0.32; 'could': 0.32; 'print': 0.32; 'url:home': 0.33; 'to:addr:python- list': 0.33; 'everyone': 0.33; "can't": 0.34; 'clear': 0.35; 'there': 0.35; 'received:org': 0.36; 'except': 0.36; 'but': 0.36; 'should': 0.36; 'itself': 0.37; 'ok,': 0.37; 'resolve': 0.37; 'does': 0.37; 'two': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'object': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'think': 0.40; 'your': 0.60; 'share': 0.61; 'card': 0.62; 'information': 0.63; 'email addr:gmail.com': 0.63; 'behavior': 0.64; 'note:': 0.64; 'horror,': 0.84; 'subject:kind': 0.84; 'xmas': 0.84; 'birthday': 0.91; 'dennis': 0.91; 'received:2': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Seome kind of unblocking input Date: Sun, 23 Sep 2012 18:13:57 +0100 References: <0be9b4c2-b661-4709-ba8f-40a6f78ad634@googlegroups.com> <593f9c45-9150-4d37-9c9c-e3cd66ed2d8e@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-2-97-77-28.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 In-Reply-To: <593f9c45-9150-4d37-9c9c-e3cd66ed2d8e@googlegroups.com> X-Antivirus: avast! (VPS 120923-0, 23/09/2012), Outbound message X-Antivirus-Status: Clean X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 61 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348420508 news.xs4all.nl 6978 [2001:888:2000:d::a6]:33966 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29828 On 23/09/2012 16:49, Ramchandra Apte wrote: > 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@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/ > > You can clear the buffer by calling file.flush() > Shock, horror, probe, well I never did. I'm sure that everyone is updating their Xmas and birthday card lists to ensure that you're not missed out having furnished a piece of information that doubtless not one other person on this group knew. -- Cheers. Mark Lawrence.