A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/067416.html below:

Anyway to check if a variable exits in other python file without NameError?

Anyway to check if a variable exits in other python file without NameError? 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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4