[Tutor] Restarting a module

Tino Dai tinoloc at gmail.com
Mon Jul 23 23:30:49 CEST 2007


On 7/23/07, Alan Gauld <alan.gauld at btinternet.com> wrote:
>
>
> "Tino Dai" <tinoloc at gmail.com> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070723/75cf453f/attachment.htm 


More information about the Tutor mailing list