Re: try except question - serious foo bar question, and pulling my hair out :-)

2009-02-24 Thread Tim Rowe
2009/2/24 Grant Edwards : > It works with a person as well as stuffed toys -- but trying to > order a person on the internet gets you in a lot more trouble. > It's also a little more embarassing when you realize your > mistake in front of a person.  OTOH, sometimes a person will > ask an enlighten

Re: try except question - serious foo bar question, and pulling my hair out :-)

2009-02-24 Thread Laszlo Nagy
Use this instead: import sys try: ??? except: e = sys.exc_value do_with(e) Only at the outermost block on your code, if ever... The fact that some exceptions don't inherit from Exception is on purpose -- usually you *dont* want to catch (and swallow) SystemExit (nor KeyboardInte

Re: try except question - serious foo bar question, and pulling my hair out :-)

2009-02-24 Thread Grant Edwards
On 2009-02-24, Steve Holden wrote: >> However, this cannot happen. This application is running >> multiple threads (10+) and every thread monitors the global >> "stop_requested" flag. If there was an unexpected error in the >> service, stop_requested.set() is called. It will stop all >> threads a

Re: try except question - serious foo bar question, and pulling my hair out :-)

2009-02-24 Thread Gabriel Genellina
En Tue, 24 Feb 2009 11:09:44 -0200, Laszlo Nagy escribió: It seems impossible to me. The while loop should only exit if stop_requested becomes set, OR if an exception is raised. However, all exceptions are cought and logged. But there are no exceptions logged. And stop_requested is NOT S

Re: try except question - serious foo bar question, and pulling my hair out :-)

2009-02-24 Thread Steve Holden
Laszlo Nagy wrote: > >>> >>> I assume stop_requested is an Event object. Maybe other thread >>> cleared it? >>> >> It was never set! -> nothing can clear it. > In theory, it could be that a thread sets the event object. E.g.: > > #1. other thread calls stop_requested.set() > #2. "while not self.s

Re: try except question - serious foo bar question, and pulling my hair out :-)

2009-02-24 Thread Laszlo Nagy
It seems impossible to me. The while loop should only exit if stop_requested becomes set, OR if an exception is raised. However, all exceptions are cought and logged. But there are no exceptions logged. And stop_requested is NOT SET. (see the last line in the log). What is happening here?

Re: try except question - serious foo bar question, and pulling my hair out :-)

2009-02-24 Thread Laszlo Nagy
I assume stop_requested is an Event object. Maybe other thread cleared it? It was never set! -> nothing can clear it. In theory, it could be that a thread sets the event object. E.g.: #1. other thread calls stop_requested.set() #2. "while not self.stop_requested.isSet()" -- loop exists #3

Re: try except question - serious foo bar question, and pulling my hair out :-)

2009-02-24 Thread Laszlo Nagy
I assume stop_requested is an Event object. Maybe other thread cleared it? It was never set! -> nothing can clear it. -- http://mail.python.org/mailman/listinfo/python-list

Re: try except question - serious foo bar question, and pulling my hair out :-)

2009-02-24 Thread Gabriel Genellina
En Tue, 24 Feb 2009 09:22:41 -0200, Laszlo Nagy escribió: Given this class below: [code removed] It seems impossible to me. The while loop should only exit if stop_requested becomes set, OR if an exception is raised. However, all exceptions are cought and logged. But there are no excep

try except question - serious foo bar question, and pulling my hair out :-)

2009-02-24 Thread Laszlo Nagy
Given this class below: import Queue import threading from sorb.util.dumpexc import dumpexc import waitablemixin PREFETCH_SIZE = 10 class Feeder(threading.Thread,waitablemixin.WaitableMixin): def __init__(self,connection_manager): self.cm = connection_manager self.expired_asin