Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting an error trying to convert dict_values to list in ipdb

In Python 3.5 I am trying to get the values from a dictionary like so:

data_dict.values()
# result: dict_values(['117487614', '117487614', '117487614'])

Now if I try to convert this into a list

list(data_dict.values())

I get an error:

*** Error in argument: '(data_dict.values())'

These expressions are being executed inside ipdb:

ipdb> patterns_and_values
{'value_{}.mainContent_root_pwdPin': '85785226', 
'value_{}.mainContent_root_txtBenutzerkennung': '85785226', 
'value_{}.mainContent_root_txtRZBK': '85785226'}

ipdb> patterns_and_values.values()
dict_values(['85785226', '85785226', '85785226'])

ipdb> list(patterns_and_values.values())
*** Error in argument: '(patterns_and_values.values())'
like image 654
Ugur Avatar asked Dec 05 '22 15:12

Ugur


1 Answers

You're using the ipdb command list from what I can understand. If ipdb follows the interface defined by pdb this doesn't invoke the list() function as you'd expect.

Exit the ipdb debugger to get this to work correctly or, again if ipdb uses the same commands as ipdb, use p list(patterns_and_values.values()) in order to get an expression evaluated inside the debugger.

like image 59
Dimitris Fasarakis Hilliard Avatar answered Dec 29 '22 00:12

Dimitris Fasarakis Hilliard