Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Craig Ringer
Sent: 15 December 2004 13:45
To: Frans Englich
Cc: Python mailing list
Subject: Re: Import trouble
On Wed, 2004-12-15 at 21:45, Frans Englich wrote:
> 2) I use Python modules which are not us
Frans Englich wrote:
Hello all,
I have a couple of questions related to module importing.
1) When I start my Python program with `python foo.py` instead of simply
adding a interpreter comment on the first line and do `./foo.py`, some
"local" imports fails, I guess because current working director
On Wednesday 15 December 2004 13:44, Craig Ringer wrote:
> On Wed, 2004-12-15 at 21:45, Frans Englich wrote:
> > 2) I use Python modules which are not usually installed(libxml2/libxslt)
> > and want to fail gracefully in case the modules aren't available; print
> > an informative message. Since the
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,e
On Wed, 2004-12-15 at 21:45, Frans Englich wrote:
> 2) I use Python modules which are not usually installed(libxml2/libxslt) and
> want to fail gracefully in case the modules aren't available; print an
> informative message. Since these imports are done in several related
> programs, I don't wa