Attribute Error: module 'collections' has no attribute 'Mapping' When Using nixnet Library in Python 3.12

Updated Jul 26, 2024

Reported In

Driver

  • NI-XNET

Programming Language

  • Python

Issue Details

Python version is 3.12, nixnet library version is 0.3.2 and Pycharm used community edition is 2023.2.5.  When I was trying to establish CAN communication and got the error "Attribute Error: module 'collections' has no attribute 'Mapping' ".
image.png

Solution

The error is caused by dependency issue.
The nixnet library is using collection lib. But in Python 3.12 the collection library was moved to collections.abc.
This issue can be fixed by updating the nixnet library to change the code to refer to collections.abc.