Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #56244

Re: How to streamingly read text file and display whenever updated text

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: How to streamingly read text file and display whenever updated text
Date 2013-10-06 11:36 +0100
References <04ee91f9-1cbf-4364-bca3-da25aa4db45f@googlegroups.com> <mailman.739.1380970927.18130.python-list@python.org> <f0461031-fd7c-42ff-b88b-c77cffcdce76@googlegroups.com> <5250e1d6$0$29984$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.773.1381055805.18130.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to streamingly read text file and display whenever updated text galeomaga@gmail.com - 2013-10-05 00:38 -0700
  Re: How to streamingly read text file and display whenever updated text galeomaga@gmail.com - 2013-10-05 00:54 -0700
    Re: How to streamingly read text file and display whenever updated text Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-05 09:12 +0100
  Re: How to streamingly read text file and display whenever updated text "James Harris" <james.harris.1@gmail.com> - 2013-10-05 09:06 +0100
    Re: How to streamingly read text file and display whenever updated text Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-05 09:14 +0100
  Re: How to streamingly read text file and display whenever updated text Nobody <nobody@nowhere.com> - 2013-10-05 11:25 +0100
  Re: How to streamingly read text file and display whenever updated text Joost Molenaar <j.j.molenaar@gmail.com> - 2013-10-05 13:02 +0200
    Re: How to streamingly read text file and display whenever updated text galeomaga@gmail.com - 2013-10-05 20:17 -0700
      Re: How to streamingly read text file and display whenever updated text Chris Angelico <rosuav@gmail.com> - 2013-10-06 14:28 +1100
      Re: How to streamingly read text file and display whenever updated text Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-06 04:06 +0000
        Re: How to streamingly read text file and display whenever updated text galeomaga@gmail.com - 2013-10-06 01:49 -0700
        Re: How to streamingly read text file and display whenever updated text Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-06 11:36 +0100
        Re: How to streamingly read text file and display whenever updated text Chris Angelico <rosuav@gmail.com> - 2013-10-06 22:03 +1100
        Re: How to streamingly read text file and display whenever updated text Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-06 12:13 +0100
        Re: How to streamingly read text file and display whenever updated text Chris Angelico <rosuav@gmail.com> - 2013-10-06 22:15 +1100
        Re: How to streamingly read text file and display whenever updated text Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-06 12:31 +0100
        Re: How to streamingly read text file and display whenever updated text Chris Angelico <rosuav@gmail.com> - 2013-10-06 22:44 +1100
          Re: How to streamingly read text file and display whenever updated text galeomaga@gmail.com - 2013-10-06 18:54 -0700
            Re: How to streamingly read text file and display whenever updated text Andreas Perstinger <andipersti@gmail.com> - 2013-10-07 11:52 +0200
  Re: How to streamingly read text file and display whenever updated text Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-05 12:08 +0100

csiph-web