Strange error with getattr() function

Hole h0leforfun at gmail.com
Mon Dec 18 11:25:21 EST 2006


Hole ha scritto:

> 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
>

I'm wondering if the exception is raised in a hidden function and not
in the explicit call to getattr(). How can I view the traceback in a
script running in zope??




More information about the Python-list mailing list