Anyway to check if a variable exits in other python file without NameError?
ed_tsang at yahoo.com
ed_tsang at yahoo.com
Tue Apr 24 13:06:38 EDT 2001
Hi am tryin to find if another variable, called EVENTHANDLEr exits
in a file caled pixit.py.
pixit.py looks like:
EVENTHANDLER = {}
print EVENTHANDLER
The following is the script I am test trying, but it always print
None. wWhat gives? Any suggestion? Or is ther another way?
guiCb = CtfGui(None)
pixitObj = None
EventHandler = None
def setPixit(value):
global pixitObj
global guiCb # setting value of guiCb
global EventHandler
pixitObj = value
guiCb.pixitObj = value # copy value
print "where are you?"
try:
EventHandler = guiCb.pixitObj.EventHandler
print EventHandler
except:
pass
exec("import pixit")
exec("reload(pixit)")
setPixit(pixit)
if EventHandler != None:
print "Hi"
else:
print EventHandler
More information about the Python-list
mailing list