Jump to content

cannot import name 'Mapping' from 'collections'


brockp

Recommended Posts

Posted

I just added the roomba plugin to my eisy setup running 6.0 and pg3,  it's not finding our roomba s9+

It doesn't start and discover doesn't appear to do anything. 

 

I can control it from the app just fine, looking in the logs there are a bunch of errors that look like python errors:

 

2025-10-06 09:14:18.142 MainThread udi_interface      INFO     __init__:<module>: Loading udi_interface module
2025-10-06 09:14:18.143 MainThread udi_interface      INFO     __init__:<module>: Loading node module
2025-10-06 09:14:18.143 MainThread udi_interface      INFO     __init__:<module>: Loading custom module
2025-10-06 09:14:18.143 MainThread udi_interface      INFO     __init__:<module>: Loading isy module
2025-10-06 09:14:18.143 MainThread udi_interface      INFO     __init__:<module>: Loading OAuth module
2025-10-06 09:14:18.144 MainThread udi_interface      INFO     __init__:<module>: UDI interface initialized
2025-10-06 09:14:18.144 MainThread udi_interface      INFO     __init__:<module>: UDI Python Interface for Polyglot version 3 3.3.18 Starting...
2025-10-06 09:14:18.146 MainThread udi_interface      ERROR    udi_interface:write: Traceback (most recent call last):
2025-10-06 09:14:18.146 MainThread udi_interface      ERROR    udi_interface:write: File "/var/polyglot/pg3/ns/0021b9026aaf_9/roomba-poly.py", line 19, in <module>
2025-10-06 09:14:18.146 MainThread udi_interface      ERROR    udi_interface:write: from roomba import Roomba
2025-10-06 09:14:18.147 MainThread udi_interface      ERROR    udi_interface:write: File "/var/polyglot/pg3/ns/0021b9026aaf_9/roomba.py", line 42, in <module>
2025-10-06 09:14:18.147 MainThread udi_interface      ERROR    udi_interface:write: from collections import Mapping
2025-10-06 09:14:18.147 MainThread udi_interface      ERROR    udi_interface:write: ImportError
2025-10-06 09:14:18.147 MainThread udi_interface      ERROR    udi_interface:write: :
2025-10-06 09:14:18.147 MainThread udi_interface      ERROR    udi_interface:write: cannot import name 'Mapping' from 'collections' (/usr/local/lib/python3.11/collections/__init__.py)

 

Posted (edited)

Hmm. This is not my plugin, but I recognize this error. The Mapping class is in collections.abc, not collections. And it's been that way since Python 3.3. I think Python 3.3-3.9 had an alias that allowed imports from collections, but that was removed in Python 3.10. But that was like 4 years ago. And udx has included Python 3.10 or 3.11 for most of that timeframe. So it doesn't make a lot of sense that it would just now be cropping up now. I guess it's possible that the Roomba plugin (or the roomba library it depends on) hasn't been updated in A LONG TIME.

Edited by Goose66
  • Like 1
Posted

I see the plugin is in a GitHub repo and it's free. The quick fix for you would be to ssh into your eisy or policy, navigate to the /var/polyglot/pg3/ns/0021b9026aaf_9/roomba.py file, and change

 from collections import Mapping

to

 from collections.abc import Mapping

using a text editor, like ee or vi

A better solution would be to fork the repository in GitHub, make the fix and make a pull request to Bob to merge it back in and upload a new version of the plugin. That way, it should work for anyone who needs it.

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...