home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
p
/
python
/
pyhtmldoc
/
e
/
exceptions
< prev
Wrap
Text File
|
1996-11-14
|
1KB
|
26 lines
<TITLE>Exceptions -- Python library reference</TITLE>
Next: <A HREF="../s/supporting_floating_point_data" TYPE="Next">Supporting Floating Point Data</A>
Prev: <A HREF="../u/unpacker_objects" TYPE="Prev">Unpacker Objects</A>
Up: <A HREF="../x/xdrlib" TYPE="Up">xdrlib</A>
Top: <A HREF="../t/top" TYPE="Top">Top</A>
<H2>10.16.3. Exceptions</H2>
Exceptions in this module are coded as class instances:
<P>
<DL><DT><B>Error</B> -- exception of module xdrlib<DD>
The base exception class. <CODE>Error</CODE> has a single public data
member <CODE>msg</CODE> containing the description of the error.
</DL>
<DL><DT><B>ConversionError</B> -- exception of module xdrlib<DD>
Class derived from <CODE>Error</CODE>. Contains no additional instance
variables.
</DL>
Here is an example of how you would catch one of these exceptions:
<P>
<UL COMPACT><CODE>import xdrlib<P>
p = xdrlib.Packer()<P>
try:<P>
p.pack_double(8.01)<P>
except xdrlib.ConversionError, instance:<P>
print 'packing the double failed:', instance.msg<P>
</CODE></UL>