B
bry
Hi,
I'm trying to do a dynamic import of a file that has no problems with it, that
is to say I can import it normally, my sys.path is set to the right folder etc.
but my dynamic import code is not working, this is the problem code:
try:
import f[0]
except:
print "not importable"
f[0] returns the name of the file I'm importing, so I suppose this is a typing
problem, should I change f[0] to be some other type?
I've also tried
t = "import " + f[0]
try:
eval(t)
except:
print "not importable"
but I always get "not importable"
I'm trying to do a dynamic import of a file that has no problems with it, that
is to say I can import it normally, my sys.path is set to the right folder etc.
but my dynamic import code is not working, this is the problem code:
try:
import f[0]
except:
print "not importable"
f[0] returns the name of the file I'm importing, so I suppose this is a typing
problem, should I change f[0] to be some other type?
I've also tried
t = "import " + f[0]
try:
eval(t)
except:
print "not importable"
but I always get "not importable"