[Tutor] Question about exception handling

Adam Bark adam.jtm30 at gmail.com
Sun Dec 17 21:04:08 CET 2006


On 17/12/06, Asrarahmed Kadri <ajkadri at googlemail.com> wrote:
>
>
> Hi Folks,
>
> Is it possible to catch exception raised in module A to be caught in
> module B.
>
> If yes, then please let me know how to do it.


You can easily test this yourself. First right a quick module, something
like this will do:

def exception_test():
    raise Exception

then start an interpreter and do the following

>>> import your_module
>>> try:
...     your_module.exception_test()
... except:
...     print "Caught it!"
...

HTH,
Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061217/64698fc2/attachment.html 


More information about the Tutor mailing list