[Tutor] temporarily modifying sys.path

Steven D'Aprano steve at pearwood.info
Mon Nov 29 13:08:17 CET 2010


Alan Gauld wrote:
> 
> "Tim Johnson" <tim at johnsons-web.com> wrote
> 
>>> Just curious, but could the imp module help you? imp.find_module
> 
>>  I'll be darned. I never even heard of that module, but I just
>>  did an import and looked at the docs. I *will* give that a try.
> 
> I think its new in Python v3...

Nah, it's been around forever:

[steve at sylar ~]$ python1.5
Python 1.5.2 (#1, Apr  1 2009, 22:55:54)  [GCC 4.1.2 20070925 (Red Hat 
4.1.2-27)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
 >>> import imp
 >>> imp.find_module('math')
(None, 'math', ('', '', 6))



-- 
Steven



More information about the Tutor mailing list