Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Python 3.10: module 'collections' has no attribute 'MutableSet' #127

Open
sohang3112 opened this issue Jul 20, 2022 · 4 comments
Open

Comments

@sohang3112
Copy link

This is because MutableSet was moved from collections module to collections.abc module in Python 3.3. So collections.abc has to be used in Python 3.3+ instead of collections.

Full traceback:

Traceback (most recent call last):
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\site-packages\watchdog\observers\__init__.py", line 86, in <module>
    from .read_directory_changes import WindowsApiObserver as Observer
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\site-packages\watchdog\observers\read_directory_changes.py", line 38, in <module>
    from watchdog.observers.api import (
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\site-packages\watchdog\observers\api.py", line 23, in <module>
    from watchdog.utils.bricks import SkipRepeatsQueue
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\site-packages\watchdog\utils\bricks.py", line 175, in <module>
    class OrderedSet(collections.MutableSet):
AttributeError: module 'collections' has no attribute 'MutableSet'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\Scripts\ptw.exe\__main__.py", line 4, in <module>
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\site-packages\pytest_watch\__init__.py", line 14, in <module>
    from .command import main, doc, version
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\site-packages\pytest_watch\command.py", line 48, in <module>
    from .watcher import watch
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\site-packages\pytest_watch\watcher.py", line 18, in <module>
    from watchdog.observers import Observer
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\site-packages\watchdog\observers\__init__.py", line 88, in <module>
    from .polling import PollingObserver as Observer
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\site-packages\watchdog\observers\polling.py", line 43, in <module>
    from watchdog.observers.api import (
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\site-packages\watchdog\observers\api.py", line 23, in <module>
    from watchdog.utils.bricks import SkipRepeatsQueue
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\site-packages\watchdog\utils\bricks.py", line 175, in <module>
    class OrderedSet(collections.MutableSet):
AttributeError: module 'collections' has no attribute 'MutableSet'
@sohang3112
Copy link
Author

Closing, since this is actually an error in the watchdog library.

@sohang3112
Copy link
Author

Actually, this error occurs because of using old watchdog version - latest watchdog version (2.1.9) doesn't have this problem.

@sohang3112
Copy link
Author

I have opened a pull request that will close this issue.

@sohang3112
Copy link
Author

@joeyespo Did you have a chance yet to review my PR (linked above) that fixes this issue? Please let me know if something in the PR needs to be improved. Thanks in advance 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant