On Mon, Mar 31, 2008 at 11:52 PM, Christian Bird <[EMAIL PROTECTED]> wrote:
> Is it possible to import multiple modules with the same name from
> different locations?
This might work:
import imp
util1 = imp.load_source('util1', 'mod1/util.py')
util2 = imp.load_source('util2', 'mod2/util.py')
B
Christian Bird wrote:
> Is it possible to import multiple modules with the same name from
> different locations? I'm using two different pieces of software, both
> of which have a module named util.py. I know that I can modify
> sys.path to fix which util gets imported when I do:
>
> import util
Is it possible to import multiple modules with the same name from
different locations? I'm using two different pieces of software, both
of which have a module named util.py. I know that I can modify
sys.path to fix which util gets imported when I do:
import util
I'd like to be able to do someth
Amit Khemka wrote:
> But It looked like an overkill, Is there a more elegant and better way
> of doing it ?
try:
path = sys.path[:]
sys.path.insert(0, mypath) # or something
import mymodule
finally:
sys.path = path
--
http://mail.python.org/mailman/l
Hello All,
I have multiple modules with same name in different directories (well
I guess thats may not be a good practise, but i needed it for
debugging and working with various versions). Now how do I import a
module with specifying a path.
Few minutes of googling suggested:
import ihooks
impor