Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

askbow
Copy link

@askbow askbow commented Oct 17, 2018

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