On Wed, 2004-12-15 at 21:44, Craig Ringer wrote:

> def import_xml:
>    try:   
>        import libxml
>    except ImportError,err:
>        # handle the error
>    return libxml
> 
> libxml = import_xml()

Though my personal approach would actually be:

try:
    import libxml
except ImportError,err:
   handle_import_error("libxml", err)

--
Craig Ringer

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to