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

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to