Bug in asyncio library - message_is_dict

Kind of a big deal
Kind of a big deal

Bug in asyncio library - message_is_dict

I'm writing a script using async io, and I keep getting this intermittent error when calling dashboard.wireless.getNetworkWirelessSsid():


  File "C:\Users\pid\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\meraki\aio\rest_session.py", line 261, in _request
    action_batch_concurrency_error = {'errors': [
UnboundLocalError: cannot access local variable 'message_is_dict' where it is not associated with a value


I've traced it back to this chunk of code in the Python asyncio library:



It tries to set message_is_dict inside an exception handler:



The problem is that goes out of scope as soon as the try handler is finished, so when the following code tries to use that variable, it no longer exists.




In my particular case, I temporarily hard-coded message_is_dict to true, and then I correctly got this error:

wireless, getNetworkWirelessSsid > https://api.meraki.com/api/v1/networks/N_xxx/wireless/ssids/3 - 400 Bad Request, {'errors': ['This endpoint only supports wireless networks']}
Meraki API error: wireless, getNetworkWirelessSsid - 400 Bad Request, {'errors': ['This endpoint only supports wireless networks']}


Get notified when there are additional replies to this discussion.
Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.