Reputation: 51
I have recently purchased a PICAN 2 board that uses the CAN module,
import CAN
bus = CAN.interface.Bus(channel='can0', bustype='socketcan_native')
msg = CAN.Message(arbitration_id=0x13C, data=[0,25,1,3,1,4,1]
bus.send(msg)
my error: AtributeError: 'module' object has no attribute 'interface'
Upvotes: 2
Views: 6831
Reputation: 1659
As rfkortekaas said - the module is called can
. I suspect you have called one of your python files CAN.py
which is why you get the error you're seeing.
Have you downloaded and installed the python-can package?
Have a look at the python-can socketcan documentation - that is what the PICAN2 board uses.
Upvotes: 2