You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if i do a candump slcan0 i can see the traffic. but when i try to use the example it fails.
Traceback (most recent call last):
File "python_socketcan_example.py", line 131, in <module>
main()
File "python_socketcan_example.py", line 127, in main
args.func(args)
File "python_socketcan_example.py", line 93, in listen_cmd
s = CANSocket(args.interface)
File "python_socketcan_example.py", line 35, in __init__
self.sock = socket.socket(socket.PF_CAN, socket.SOCK_RAW, socket.CAN_RAW)
AttributeError: 'module' object has no attribute 'PF_CAN'```
another post in issue talks about socket_native
^Croot@DietPi:~# python
Python 2.7.13 (default, Sep 26 2018, 18:42:22)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import can
>>> can.rc['interface'] = 'socketcan_native'
>>> can.rc['channel'] = 'slcan0'
>>> bus = can.interface.Bus()
>>>
python_socketcan only uses built-in Python libraries and does not depend on any third-party code. Socketcan is only natively supported in Python 3.3+. Python 2.7 does not have built-in socketcan support.
Activity
abencz commentedon Feb 7, 2020
python_socketcan only uses built-in Python libraries and does not depend on any third-party code. Socketcan is only natively supported in Python 3.3+. Python 2.7 does not have built-in socketcan support.
Try running the example with Python 3.