Skip to main content

A package for handling CAN bus signals on Linux SocketCAN, for Python 3.3 and later.

Project description

Introduction to can4python

A package for handling CAN bus (Controller Area Network) signals on Linux SocketCAN, for Python 3.3 and later.


  • Sends and receives CAN frames.
  • Handles parsing of CAN signals from CAN frames.
  • Uses SocketCAN for Linux.
  • For Python 3.3 or later. Python 3.4 is required for some functionality.
  • Implemented as pure Python files, without any external dependencies.
  • Suitable for use with BeagleBone and Raspberry Pi embedded Linux boards.
  • Configuration using the open source KCD file format.
  • Throttle incoming frames to reduce frame rate.
  • Filtering of incoming frames on data changes. This is done via a bit mask in the Linux kernel.
  • Periodic frame transmission executed by the Linux kernel (not by Python code).

Configuration file format

This CAN library uses the KCD file format for defining CAN signals and CAN messages. It is an open-source file format for describing CAN bus relationships. See for details on the format, and example files.

The licensing of the KCD file format is, according to the web page:

The files that are describing the format are published under the Lesser GPL license.
The KCD format is copyrighted by Jan-Niklas Meier (dschanoeh) and Jens Krueger (julietkilo).
According to the authors this does not imply any licensing restrictions on
software libraries implementing the KCD file format, or on software using those libraries.

Traditionally CAN bus relationships are described in DBC files, a file format owned by Vector Informatik GmbH. There are open source DBC-to-KCD file format converters available, for example the CANBabel tool:

Known limitations

  • Not all CAN functionality is implemented. ‘Error frames’ and ‘remote request frames’ are not handled, and CAN multiplex signals are not supported.
  • Not all features of the KCD file format are implemented, for example ‘Labels’.
  • It is assumed that each CAN signal name only is available in a single CAN frame ID.

Installation and usage

See separate documentation pages.


0.1.1 (2015-11-16)

  • Improved documentation

0.1.0 (2015-09-22)

  • First release on GitHub.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for can4python, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size can4python-0.1.1-py2.py3-none-any.whl (43.8 kB) File type Wheel Python version 3.4 Upload date Hashes View
Filename, size can4python-0.1.1.tar.gz (55.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page