zidarsk8 zidarsk8 - 10 months ago 53
Python Question

Itertools.product raises "Error in argument"

I am a bit lost here:

I can not use

in my code. This is in a break point in unittest

ipdb> import itertools
ipdb> itertools
<module 'itertools' (built-in)>
ipdb> itertools.product
<class 'itertools.product'>
ipdb> list(itertools.product([2,7], [1,4]))
*** Error in argument: '(itertools.product([2,7], [1,4]))'

I am Pretty sure that I'm not doing anything weird with the module itself since this is in my codebase (no uncommite changes there):

$ git grep itertools
simple_wbd/climate.py:import itertools

If I try this in Ipython interpreter it works fine.

In [1]: import itertools

In [2]: list(itertools.product([2,7], [1,4]))
Out[2]: [(2, 1), (2, 4), (7, 1), (7, 4)]

I don't even know how to debug this. Any help would be nice.

Thank you.

wim wim

In this debugger, list is a command. For access to the builtin name you were intending, prepend an exclam:

ipdb> list(itertools.product([2,7], [1,4])
*** Error in argument: '(itertools.product([2,7], [1,4])'
ipdb> !list(itertools.product([2,7], [1,4]))
[(2, 1), (2, 4), (7, 1), (7, 4)]

This should not be an issue in the code itself, only within the debugger.