bradcfisher / OctoPrint-ExcludeRegionPlugin

OctoPrint plugin that adds the ability to prevent printing within rectangular or circular regions of the currently active gcode file.
GNU Affero General Public License v3.0
55 stars 5 forks source link

Python 3.10 compatibility #64

Closed jaketri closed 1 year ago

jaketri commented 2 years ago

Move Mapping to collections.abc (from collections) to fix following error with python 3.10:

2022-01-12 19:52:44,119 - octoprint.plugin.core - ERROR - Error loading plugin excluderegion
Traceback (most recent call last):
  File "/home/octoprint/venv/lib/python3.10/site-packages/octoprint/plugin/core.py", line 1291, in _import_plugin
    module = _load_module(module_name, spec)
  File "/home/octoprint/venv/lib/python3.10/site-packages/octoprint/plugin/core.py", line 68, in _load_module
    return imp.load_module(name, f, filename, details)
  File "/home/octoprint/venv/lib/python3.10/site-packages/octoprint/vendor/imp.py", line 238, in load_module
    return load_package(name, filename)
  File "/home/octoprint/venv/lib/python3.10/site-packages/octoprint/vendor/imp.py", line 212, in load_package
    return _load(spec)
  File "<frozen importlib._bootstrap>", line 719, in _load
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/octoprint/venv/lib/python3.10/site-packages/octoprint_excluderegion/__init__.py", line 48, in <module>
    from .ExcludeRegionState import ExcludeRegionState
  File "/home/octoprint/venv/lib/python3.10/site-packages/octoprint_excluderegion/ExcludeRegionState.py", line 8, in <module>
    from collections import OrderedDict, Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
jneilliii commented 2 years ago

@bradcfisher any chance we can get this PR merged and new release to resolve #65 and others. We have started to get reports of this error in Discord and not only in Windows but also in newer linux distros.

katiekloss commented 1 year ago

I've adopted this plugin, a release including this fix is available here (or just by installing the plugin normally, when it's been accepted):

https://github.com/katiekloss/OctoPrint-ExcludeRegion/releases/tag/v0.3.1

bradcfisher commented 1 year ago

FYI, I do intend to continue to maintain this version of my plugin. To that end, I have released v1.3.1 with this update. More in the works as I can find time.