Re: Strange error with getattr() function
Gabriel Genellina ha scritto: > At Monday 18/12/2006 13:25, Hole wrote: > > > > 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?? > > (Which Zope version?) > If you don't catch the exception, an error page will be displayed, > pointing to the error_log object. > > Hi Gabriel, thanks a lot for your replies. I've resolved the problem catching the exception and printing the traceback in a file. The problem was, indeed, in a getattr() call performed in another function, to which I passed an int rather than a string. Bye! -- DN -- http://mail.python.org/mailman/listinfo/python-list
Re: Strange error with getattr() function
At Monday 18/12/2006 13:25, Hole wrote: > 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?? (Which Zope version?) If you don't catch the exception, an error page will be displayed, pointing to the error_log object. -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas -- http://mail.python.org/mailman/listinfo/python-list
Re: Strange error with getattr() function
At Monday 18/12/2006 12:33, Hole wrote: I'm trying to use Zope and the product OpenFlow. Try posting in the Zope list, you surely will have more responses. 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 Are you sure it's a string? Some objects have an id() method. You always should use getId(). 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 getattr is acquisition-aware so you might be retrieving another thing... 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!) If you're really sure of this, I think the error may occur inside another function in the getattr chain. -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas -- http://mail.python.org/mailman/listinfo/python-list
Re: Strange error with getattr() function
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?? -- http://mail.python.org/mailman/listinfo/python-list
Strange error with getattr() function
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 -- http://mail.python.org/mailman/listinfo/python-list