1

I'm working with CAN cable ECOM, and trying to write a python script to process the messages received from the cable. I came across the python library python-can, but I'm having trouble using it.

When I try to run the code:

import can
bus = can.interface.Bus(bustype='socketcan', channel='vcan0', bitrate=500000)

I get this:

enter image description here

Is there something I'm missing from this library that's causing the issue?

Thank you very much for your kind help.

belwood
  • 3,320
  • 11
  • 38
  • 45
Yuki
  • 21
  • 5

2 Answers2

1

Figured out the problem: SocketCan works with Linux system, and I'm on Windows machine.

Yuki
  • 21
  • 5
0

Use the following parameters if you are using PCAN on windows via USB:

import can    
bus = can.interface.Bus(bustype='pcan', channel='PCAN_USBBUS1', bitrate=500000)

You can find more help here.

Hope this helps!

Vishal R
  • 1,279
  • 1
  • 21
  • 27