W
Wensheng
I have a py program below:
--------------------------------
class someclass:
def __init__(self):
self.var = "hell, world"
def printitout(self):
execfile("printit.py")
#__import__("printit") #doesn't work
if __name__=="__main__":
c = someclass()
c.printitout()
-------------------------------------------
the file printit.py has only one line:
--------------
print self.var
--------------
executing someclass works, but I can't replace execfile with import.
what globals, locals should I use to make __import__() work in that
situation?
Thank you for any help.
--------------------------------
class someclass:
def __init__(self):
self.var = "hell, world"
def printitout(self):
execfile("printit.py")
#__import__("printit") #doesn't work
if __name__=="__main__":
c = someclass()
c.printitout()
-------------------------------------------
the file printit.py has only one line:
--------------
print self.var
--------------
executing someclass works, but I can't replace execfile with import.
what globals, locals should I use to make __import__() work in that
situation?
Thank you for any help.