Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'subject:text': 0.05; 'debug': 0.07; 'practice,': 0.07; 'problem?': 0.07; 'subject:file': 0.07; '__name__': 0.09; 'except:': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'try:': 0.09; 'subject:How': 0.10; "'__main__':": 0.16; 'incorrect': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'red,': 0.16; 'rogue': 0.16; 'subject: \n ': 0.16; 'thread,': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'translated': 0.19; 'print': 0.22; 'header:User-Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'chris': 0.29; 'code': 0.31; '-0700,': 0.31; 'crash': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'programmers': 0.33; 'could': 0.34; 'problem': 0.35; "can't": 0.35; 'except': 0.35; 'but': 0.35; 'e.g.': 0.38; 'to:addr:python-list': 0.38; 'expect': 0.39; 'url:01': 0.39; 'bad': 0.39; 'extremely': 0.39; 'realize': 0.39; 'to:addr:python.org': 0.39; 'unable': 0.39; 'received:org': 0.40; 'how': 0.40; 'remove': 0.60; 'most': 0.60; 'more': 0.64; 'believe': 0.68; 'benefit': 0.68; 'smith': 0.68; 'url:2011': 0.75; 'url:wordpress': 0.78; 'bare': 0.84; 'horrible': 0.84; 'improvement,': 0.84; 'preventing': 0.84; 'received:2': 0.84; 'subject:read': 0.84; 'novice': 0.91; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: How to streamingly read text file and display whenever updated text Date: Sun, 06 Oct 2013 11:36:32 +0100 References: <04ee91f9-1cbf-4364-bca3-da25aa4db45f@googlegroups.com> <5250e1d6$0$29984$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: host-2-98-207-126.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0 In-Reply-To: <5250e1d6$0$29984$c3e8da3$5496439d@news.astraweb.com> 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: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1381055805 news.xs4all.nl 15907 [2001:888:2000:d::a6]:55872 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:56244 On 06/10/2013 05:06, Steven D'Aprano wrote: > On Sat, 05 Oct 2013 20:17:32 -0700, galeomaga wrote: > > >> if __name__ == '__main__': >> try: >> thread.start_new_thread( readfile, ("Thread-1", ) ) >> except: >> print "Error: unable to start thread" > > > Why not? If you can't start a thread, you have a problem with your code. > How do you expect to debug this problem? > > > "I find it amusing when novice programmers believe their main job is > preventing programs from crashing. More experienced programmers realize > that correct code is great, code that crashes could use improvement, but > incorrect code that doesn’t crash is a horrible nightmare." > -- Chris Smith > > http://cdsmith.wordpress.com/2011/01/09/an-old-article-i-wrote/ > > Roughly translated for the benefit of newbies remove the try/except :) Also note that a bare except is extremely bad practice, e.g. you can't stop rogue programs with a CTRL-C -- Roses are red, Violets are blue, Most poems rhyme, But this one doesn't. Mark Lawrence