This release is a pre-release and may not be stable for production use.
The Controller Area Network is a bus standard designed to allow microcontrollers and devices to communicate with each other. It has priority based bus arbitration and reliable deterministic communication. It is used in cars, trucks, boats, wheelchairs and more.
The can package provides controller area network support for Python developers; providing common abstractions to different hardware devices, and a suite of utilities for sending and receiving messages on a can bus.
The library supports Python 2.7, Python 3.4+ as well as PyPy 2 & 3 and runs on Mac, Linux and Windows.
Features
common abstractions for CAN communication
support for many different backends (see the docs)
receiving, sending, and periodically sending messages
normal and extended arbitration IDs
limited CAN FD support
many different loggers and readers supporting playback: ASC (CANalyzer format), BLF (Binary Logging Format by Vector), CSV, SQLite and Canutils log
efficient in-kernel or in-hardware filtering of messages on supported interfaces
bus configuration reading from file or environment variables
CLI tools for working with CAN busses (see the docs)
more
Example usage
# import the library
import can
# create a bus instance
# many other interfaces are supported as well (see below)
bus = can.Bus(interface='socketcan',
channel='vcan0',
receive_own_messages=True)
# send a message
message = can.Message(arbitration_id=123, extended_id=True,
data=[0x11, 0x22, 0x33])
bus.send(message, timeout=0.2)
# iterate over received messages
for msg in bus:
print("{X}: {}".format(msg.arbitration_id, msg.data))
# or use an asynchronous notifier
notifier = can.Notifier(bus, [can.Logger("recorded.log"), can.Printer()])
You can find more information in the documentation, online at python-can.readthedocs.org.
Discussion
If you run into bugs, you can file them in our issue tracker on GitHub.
There is also a python-can mailing list for development discussion.
Stackoverflow has several questions and answers tagged with python+can.
Wherever we interact, we strive to follow the Python Community Code of Conduct.
Contributing
See doc/development.rst for getting started.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python-can-2.3.0a3.tar.gz.
File metadata
- Download URL: python-can-2.3.0a3.tar.gz
- Upload date:
- Size: 127.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
099f84baad7e0ce81d20c3387f8a29bb85b7827f7e16571b21314b953bba63b0
|
|
| MD5 |
c9585d58012b9a36408c36bd2cbaa544
|
|
| BLAKE2b-256 |
3530be01c2d891bc3f2324c455845bc4a3fbebde5840b1ba3959fc848d8f051f
|
File details
Details for the file python_can-2.3.0a3-py2.py3-none-any.whl.
File metadata
- Download URL: python_can-2.3.0a3-py2.py3-none-any.whl
- Upload date:
- Size: 122.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c7d4010057f80e20a875b74966d75d84fed51affb8c975e7ea5ce3fdcba6470
|
|
| MD5 |
f60f357e77b960f7d4be15d67573334a
|
|
| BLAKE2b-256 |
18bbb6736b245d2dc1b35bb850233681fa0699d08d33acefe74c04a005fe59c3
|