TypeError: 'dict_keys' object does not support indexing

91 views
Skip to first unread message

rachna bafna

unread,
Sep 24, 2018, 6:12:49 PM9/24/18
to codename-taurus
I am getting following error for my tests which were running perfectly until some time back. Any clue what could cause this?

[2018-09-24 21:11:42,313 ERROR root] TypeError: 'dict_keys' object does not support indexing
File "/usr/lib/python3.5/site-packages/bzt/cli.py", line 261, in perform
self.engine.run()
File "/usr/lib/python3.5/site-packages/bzt/engine.py", line 226, in run
reraise(exc_info, exc_value)
File "/usr/lib/python3.5/site-packages/bzt/six/py3.py", line 85, in reraise
raise exc
File "/usr/lib/python3.5/site-packages/bzt/engine.py", line 206, in run
self._wait()
File "/usr/lib/python3.5/site-packages/bzt/engine.py", line 247, in _wait
while not self._check_modules_list():
File "/usr/lib/python3.5/site-packages/bzt/engine.py", line 234, in _check_modules_list
finished = bool(module.check())
File "/usr/lib/python3.5/site-packages/bzt/modules/blazemeter.py", line 489, in check
self.__send_data(self.kpi_buffer)
File "/usr/lib/python3.5/site-packages/bzt/modules/blazemeter.py", line 140, in _impl
method(self, *args, **kwargs)
File "/usr/lib/python3.5/site-packages/bzt/modules/blazemeter.py", line 504, in __send_data
serialized = self._dpoint_serializer.get_kpi_body(data, is_final)
File "/usr/lib/python3.5/site-packages/bzt/modules/blazemeter.py", line 699, in get_kpi_body
self.__add_errors(report_item, kpi_set) # 'Errors' tab
File "/usr/lib/python3.5/site-packages/bzt/modules/blazemeter.py", line 733, in __add_errors
"url": error['urls'].keys()[0] if error['urls'] else None,
[2018-09-24 21:11:42,313 INFO Engine] Post-processing.

Appreciate your help on this.

Andrey Pokhilko

unread,
Sep 29, 2018, 7:50:12 AM9/29/18
to codename-taurus
Hi,
Does this happen always or not? We'd need some more context to understand what happens

--
You received this message because you are subscribed to the Google Groups "codename-taurus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codename-taur...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codename-taurus/0e476c83-f89e-4ead-abc4-adb330af2d5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dimitri Pribysh

unread,
Oct 1, 2018, 7:34:55 AM10/1/18
to codenam...@googlegroups.com

It looks like the issue is that `dict.keys()` returns different types of objects in Python 2 and 3. It returns plain list in py2 and `dict_keys` object (which is pretty much an iterator) in py3.

So it looks like a relatively simple bug. I've created a fix for it: https://github.com/Blazemeter/taurus/pull/964

Thanks for reporting!


  Dimitri
Reply all
Reply to author
Forward
0 new messages