Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.053 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; '22,': 0.09; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'mon,': 0.24; 'equivalent': 0.26; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'external': 0.29; 'errors': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'breaking': 0.31; 'controlled': 0.31; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'received:google.com': 0.35; 'received:209': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'catch': 0.60; 'hardware': 0.61; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=bnEX5gI9JEBHe8ijNx/AiXC9RxjCIiqErJhyVHzun4Y=; b=aEqqhGO+JUztWpnGo5iyVaajukJFOnH172N5H/khoDG6xCoJABILwEJCJw0nviGOtn AZC67fdsewooB2jJpHtKeTlyrYfpBJqKQxRMp15UwSny7emWrUeuPBfYojL0zfPgaK1A lJ4Ygwk3GUYSIDvRMjMZ4iESbQtlqkNNWarwnDpGZFL/QHGA2loT2WWFXJyi2yQ7pazo SuXS8hQ10cHvh281VjVkkCBShp20uHOXlH4bpR9tcnJOdRQUrZtF+RUBwUtSlH0LBiWG 1E7mi2jmb/jtuq7I0Pfg6KgGsvrrf7a0yyV6TJPGltwfuf3FQJdtKfqnoxSTh+ue27Gh qgzQ== MIME-Version: 1.0 X-Received: by 10.58.75.46 with SMTP id z14mr19120582vev.52.1366643301138; Mon, 22 Apr 2013 08:08:21 -0700 (PDT) In-Reply-To: References: Date: Tue, 23 Apr 2013 01:08:21 +1000 Subject: Re: kbhit/getch python equivalent From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 9 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1366643310 news.xs4all.nl 2212 [2001:888:2000:d::a6]:39962 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44086 On Mon, Apr 22, 2013 at 11:34 PM, alb wrote: > I'm looking for a kbhit/getch equivalent in python in order to be able > to stop my inner loop in a controlled way (communication with external > hardware is involved and breaking it abruptly may cause unwanted errors > on the protocol). Catch KeyboardInterrupt and hit Ctrl-C. ChrisA