how to check if a module is importable?
Robert P. J. Day
rpjday at crashcourse.ca
Wed Jan 20 09:51:07 EST 2010
On Thu, 21 Jan 2010, Lie Ryan wrote:
> On 01/20/10 19:58, Robert P. J. Day wrote:
> >
> > finally getting back to clawing my way thru the python 3 book so
> > probably a number of newbie questions coming up. first one -- can i
> > check if a module is importable (equivalently, exists on sys.path, i
> > assume) without trying to import it first?
> >
> > i can see that i can use try/except and just run "import" -- is that
> > the accepted way to test?
>
> check imp.find_module()
thanks, that's what i was looking for. i'm sure i'll run across
that shortly as i keep working my way thru this python 3 book.
rday
--
========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA
Linux Consulting, Training and Kernel Pedantry.
Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================
More information about the Python-list
mailing list