Skip to content

Import fails on python 3.10 #30

@pkesso

Description

@pkesso

I tried to use pyspectator with python 3.10 on Windows 11 and got this error:

>>> from pyspectator.computer import Computer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\admin\Documents\python\dashboard_win\lib\site-packages\pyspectator\computer.py", line 5, in <module>
    from pyspectator.memory import NonvolatileMemory, VirtualMemory, SwapMemory
  File "C:\Users\admin\Documents\python\dashboard_win\lib\site-packages\pyspectator\memory.py", line 5, in <module>
    from pyspectator.collection import LimitedTimeTable
  File "C:\Users\admin\Documents\python\dashboard_win\lib\site-packages\pyspectator\collection.py", line 1, in <module>
    from collections import MutableMapping, Container
ImportError: cannot import name 'MutableMapping' from 'collections' (C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\collections\__init__.py)

It seems to be specific for modern python versions (3.9+) : https://docs.python.org/3.9/whatsnew/3.9.html#you-should-check-for-deprecationwarning-in-your-code

And it works this way now:

>>> from collections import MutableMapping
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'MutableMapping' from 'collections' (C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\collections\__init__.py)
>>> from collections.abc import MutableMapping
>>>

pyspectator==1.2.2
Python 3.10.0
Windows11 x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions