Skip to content

fix TypeError: 'itertools.imap' object has no attribute 'getitem'#2

Open
askbow wants to merge 1 commit into
wifinigel:masterfrom
askbow:master
Open

fix TypeError: 'itertools.imap' object has no attribute 'getitem'#2
askbow wants to merge 1 commit into
wifinigel:masterfrom
askbow:master

Conversation

@askbow

@askbow askbow commented Oct 17, 2018

Copy link
Copy Markdown

We were having python exceptions like this:
TypeError: 'itertools.imap' object has no attribute 'getitem'

for lines

for mcs_octet in range(3, 7):
        
            mcs_octet_value = dot11_elt_dict[ht_capabilities][mcs_octet]

and

    # check if 11ac supported
    if vht_capabilities in dot11_elt_dict.keys():
        
        # Check for number streams supported
        mcs_upper_octet = dot11_elt_dict[vht_capabilities][5]
        mcs_lower_octet = dot11_elt_dict[vht_capabilities][4]

I.e. each element from dot11_elt_dict is an itertools.imap object, for example:
{'59': <itertools.imap object at 0xffff79cb4c10>, '48': <itertools.imap object at 0xffff79cb4950>, '33': <itertools.imap object at 0xffff79cb4890>, '45': <itertools.imap object at 0xffff79cb4a10>, '191': <itertools.imap object at 0xffff79cb4b10>, '36': <itertools.imap object at 0xffff79cb4910>, '1': <itertools.imap object at 0xffff79cb4810>, '0': <itertools.imap object at 0xffff79cb4790>, '127': <itertools.imap object at 0xffff79cb4a90>, '221': <itertools.imap object at 0xffff79cb4b90>, '220': <itertools.imap object at 0xffff79cb4c90>}

This fix creates lists needed and puts elements from itertools.imap objects onto these lists, preserving order.
We can then access the elements with [id] without producing an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant