drygdryg / netbox-plugin-device-map

A simple device map plugin with filtering criteria for NetBox
MIT License
41 stars 5 forks source link

TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'NoneType' #4

Closed lumenods closed 8 months ago

lumenods commented 11 months ago

Hello, I start use netbox-plugin-device-map, I just have enabled plugin in configuration.py in section PLUGINS and I have problem in my console:

Oct 01 18:23:39 netbox gunicorn[187834]:     return _bootstrap._gcd_import(name[level:], package, level)
Oct 01 18:23:39 netbox gunicorn[187834]:   File "/opt/netbox-3.6.3/venv/lib/python3.9/site-packages/netbox_device_map/urls.py", line 2, in <module>
Oct 01 18:23:39 netbox gunicorn[187834]:     from . import views
Oct 01 18:23:39 netbox gunicorn[187834]:   File "/opt/netbox-3.6.3/venv/lib/python3.9/site-packages/netbox_device_map/views.py", line 11, in <module>
Oct 01 18:23:39 netbox gunicorn[187834]:     from .geographical_map import configure_leaflet_map
Oct 01 18:23:39 netbox gunicorn[187834]:   File "/opt/netbox-3.6.3/venv/lib/python3.9/site-packages/netbox_device_map/geographical_map.py", line 4, in <module>
Oct 01 18:23:39 netbox gunicorn[187834]:     from .helpers import get_connected_devices, LatLon
Oct 01 18:23:39 netbox gunicorn[187834]:   File "/opt/netbox-3.6.3/venv/lib/python3.9/site-packages/netbox_device_map/helpers.py", line 16, in <module>
Oct 01 18:23:39 netbox gunicorn[187834]:     def get_device_location(device: Device) -> LatLon | None:
Oct 01 18:23:39 netbox gunicorn[187834]: TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'NoneType'
pv2b commented 11 months ago

From your logs it looks like you're using Python 3.9. This plugin is only tested on 3.10 and above. In this case it appears the problem is occurring because of the use of the X | Y notation for union types, which is only supported on Python 3.10 and above.

Please ensure you're running a supported Python version that's supported by the plugin.

lumenods commented 11 months ago

Thank's, I've upgraded and it's work!