meraki / dashboard-api-python

Official Dashboard API library (SDK) for Python
MIT License
287 stars 149 forks source link

Update rest_session.py #215

Closed TKIPisalegacycipher closed 1 year ago

TKIPisalegacycipher commented 1 year ago

Add Python version check. 3.7 minimum required. Validation tested and confirmed working on 3.6.8, 3.7.9, 3.10.11, and 3.11.

msheiny commented 1 year ago

Hey @TKIPisalegacycipher

I'm seeing this fail in AWS Lambda... trying to debug but getting the following error message

This library requires Python 3.7 at minimum. Python versions 3.6 and below are end of life and end of support per the Python maintainers, and your interpreter version is 3.8.16 (default, Mar 28 2023, 11:04:35) \n[GCC 7.3.1 20180712 (Red Hat 7.3.1-15)]. Please consult the readme at your convenience: https://github.com/meraki/dashboard-api-python

image

Let me know if I can provide any additional data to debug

TKIPisalegacycipher commented 1 year ago

Hi @msheiny thanks for reporting this. Can you drop to a console in your Python environment and provide the output of this script?

import sys

print(f'sys.version_info[0] is {sys.version_info[0]}')
print(f'sys.version_info[1] is {sys.version_info[1]}')
print(f'sys.version_info is {sys.version_info}')
print(f'sys.version is {sys.version}')

For example, here's the output in my environment:

~#@❯ python                                                                                                      ❮  
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>>
>>> print(f'sys.version_info[0] is {sys.version_info[0]}')
sys.version_info[0] is 3
>>> print(f'sys.version_info[1] is {sys.version_info[1]}')
sys.version_info[1] is 11
>>> print(f'sys.version_info is {sys.version_info}')
sys.version_info is sys.version_info(major=3, minor=11, micro=4, releaselevel='final', serial=0)
>>> print(f'sys.version is {sys.version}')
sys.version is 3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]
>>>
msheiny commented 1 year ago

I added a bunch of logging to my lambda

image

msheiny commented 1 year ago

I looked over your code, im kind of baffled why this is failing. The above was logging lines I added within the code. I can't poke into the AWS lambda environment shell directly.

TKIPisalegacycipher commented 1 year ago

I'm no AWS expert but based on this article I presume you're using a lambda layer containing the meraki package. It also looks like a lambda layer can run a different version of Python than the lambda itself.

For that reason I suspect a mismatch somewhere. But you may want to consult AWS support or an AWS expert for more guidance here. In any case, I don't see any sign that the package itself is malfunctioning, but I'm open to reasonable improvements on this relatively simple version check.

msheiny commented 1 year ago

Looks like I'm not using any layers 😕

image

I also thought Amazon dropped support for Python <= 3.6

Yeah, i'll keep digging. This is really weird.