>>> import imp >>> imp.find_module("os") (<open file '/usr/lib/python2.7/os.py', mode 'U' at 0xb6c4c700>, '/usr/lib/python2.7/os.py', ('.py', 'U', 1)) >>>
2011/12/23 Gnarlodious <gnarlodi...@gmail.com> > Given a module's name, how do I get the file path without importing it? > Searched all over, can't find any such info. > > Is it possible to ask if a named module exists before attempting an import? > > Or are we forced to import first and catch any failure? > > -- Gnarlie > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://yasar.serveblog.net/
-- http://mail.python.org/mailman/listinfo/python-list