On 7/23/07, Alan Gauld <[EMAIL PROTECTED]> wrote:


"Tino Dai" <[EMAIL PROTECTED]> wrote

> Sorry about that. I think that a simpler question would be:

I'm not sure what the better question is, but I think I
answered it :-)

> In my driver code:
>
>  ap = apacheModule.apacheModule(configXML)
>  while 1:
>       try:
>          rVs=ap.perf()
>          for anObj in self.objList:
>               getattr(anObj,"do")(rVs)
>          time.sleep(1)
>        except ArraryOutOfBoundsException:
>          pass
>       except Exception, e:
>          sys.stdout.write(str(e) + "\n")
>          sys.exit(1)
>
>
> And in my apacheModule class:
>
>         try:
>
> (totalAccess,totalTraffic)=(rVs[3][1],self.sizeConvert ...
>         except Exception,e:
>                datetime.datetime.now()
>                sys.stdout.write(str(e) + "\n")
>                sys.stdout.write(rVs)
>
> If the apacheModule raises an ArrayOutOfBound exception (don't
> remember if that the real exception name), the exception will bubble
> up, and
> the apacheDriver try-except will catch it, right?

No, if you catch it here, as you will if you catch all Exceptions,
then
it will stop right there unless you explicitly raise it. You bneed to
add a
raise statement after the stdout.write stuff.

Alan G.


Thanks Alan,

   That makes a lot of sense. I will be see what I can do tomorrow with a
revision of the code.

Thanks again,
Tino
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to