Thanks a lot Fredrik,
A big wave of deja vu came over me as I read your note. That bit me once
before, and was my only previous run-in with the 'global' directive
which clearly didn't stick with me. :(
Thanks for the concise, helpful reply. The universe makes sense again.
-Ross.
Fredrik Lundh wrote:
http://docs.python.org/ref/naming.html
"If a name binding operation occurs anywhere within a code block, all
uses of the name within the block are treated as references to the
current block. This can lead to errors when a name is used within a
block before it is bound."
to fix this, use the global directive:
http://docs.python.org/ref/global.html
def OnOutfileButton(self,evt):
global outXMLfile # flag variable as global
fPath, fName = os.path.split(fullName)
print "Selected output file:", fName
outXMLfile = fName
...
</F>
--
http://mail.python.org/mailman/listinfo/python-list