[Zope] Catching specific exceptions in Python Script?

Etienne Labuschagne ELabuschagne@gims.com
Thu, 5 Jul 2001 10:55:52 +0200


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C10530.4B2660E0
Content-Type: text/plain;
	charset="iso-8859-1"

Hi all

I would like to be able to catch specific exceptions with Python Scripts:

eg.

try:
  .....
except Exception, e:
  .....

of

try:
  ....
except sql.error, e:
 ....

This doesn't work as none of these exceptions are imported, also I cannot
import them due to the import constraints of Python Scripts.  Is there a
workaround for this other than using external methods?

Etienne

------_=_NextPart_001_01C10530.4B2660E0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>Catching specific exceptions in Python Script?</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2 FACE=3D"Arial">Hi all</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">I would like to be able to catch =
specific exceptions with Python Scripts:</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">eg.</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">try:</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; .....</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">except Exception, e:</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; .....</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">of</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">try:</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; ....</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">except sql.error, e:</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;....</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">This doesn't work as none of these =
exceptions are imported, also I cannot import them due to the import =
constraints of Python Scripts.&nbsp; Is there a workaround for this =
other than using external methods?</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Etienne</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C10530.4B2660E0--