Skip to content

slcan0 #1

Open
Open

Description

@faheemadam

hi

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()
>>> 

Activity

  1. abencz commented on Feb 7, 2020

    @abencz
    Owner

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions