Strange error with getattr() function
Hole
h0leforfun at gmail.com
Mon Dec 18 10:33:00 EST 2006
Hi There!
I'm trying to use Zope and the product OpenFlow.
I got the following error while I was using the built-in function
getattr() to retrieve an OpenFlow object:
attribute name must be string
Actually, I surely pass a string as attribute name to getattr()
The code:
#following instruction returns me the string "WorkFlowTest"
openflow_id=container.aq_parent.id
if (hasattr(container,openflow_id):
#the interpreter enter in this block, so
#it's sure that container has an attribute called WorkFlowTest
openflow=getattr(container,openflow_id)
At this point, I got the error: attribute name must be string
The *strange* is that I get the same error even if I pass the attribute
name to the getattr() function as pure string:
getattr(container,"WorkFlowTest")
(sic!!!!!)
I'm a lot confused!
Thanks in advance.
--
H0le
More information about the Python-list
mailing list