Linenumbers of traceback wrong

Peter Otten __peter__ at web.de
Thu Feb 26 07:58:06 EST 2004


Thomas Guettler wrote:

> Sometimes the linenumbers of a traceback are wrong.
> 
> See this traceback. I don't use any attribute "key" here.
> The method search_dict does not use this attribute, too.
> 
> Traceback (most recent call last):
>   File
>  
"/mnt/raid/modarch/workflow/python/lib/python2.3/site-packages/quixote/publish.py",
>   line 553, in publish
>     output = self.process_request(request, env)
>   File
>  
"/mnt/raid/modarch/workflow/python/lib/python2.3/site-packages/quixote/publish.py",
>   line 535, in process_requ
>     output = self.try_publish(request, env.get('PATH_INFO', ''))
>   File "/mnt/raid/modarch/workflow/lib/ZEOClientPublisher.py", line 198,
>   in try_publish
>     return Publisher.try_publish(self, request, path)
>   File
>  
"/mnt/raid/modarch/workflow/python/lib/python2.3/site-packages/quixote/publish.py",
>   line 483, in try_publish
>     output = object(request)
>   File "/mnt/raid/modarch/workflow/lib/WorkflowServer.py", line 726, in
>   search
>     buchungsdatum_bis))
>   File "/mnt/raid/modarch/workflow/lib/SearchCatalog.py", line 302, in
>   search_dict
>     ids_dict.update(this_ids_dict)
> AttributeError: keys
> 
> Python 2.3.2 (#1, Nov 20 2003, 12:57:28)
> [GCC 2.95.3 20010315 (SuSE)] on linux2
> 
> 
> "keys" get used here:
> 
>     def search(self, attr, value, maxvalue=None):
>         result_dict=self.search_dict(attr, value, maxvalue)
>         return result_dict.keys()
> 
> ids_dict was created with "ids_dict={}"
> 
> Any hints?

Consider:

>>> d = {1:2, 3:4}
>>> d.update(["a", "b"])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: keys
>>> d.update({"a":1, "b":2})

dict.update() tries to access the keys method, so you should check if 
this_ids_dict is really a dictionary.

Peter



More information about the Python-list mailing list