Skip to main content

Python wrapper for Kvaser CANlib

Project description

canlib - a Python wrapper for Kvaser CANlib

Supported Libraries and Installation

The Python canlib module wraps the Kvaser CANlib API in order to make it easy to control most aspects of any Kvaser CAN interface. For more information about Kvaser please go to https://www.kvaser.com/.

The latest version of this package is available on the Kvaser Download page (pycanlib.zip).

Supported platforms

Windows and Linux using Python v3.6+ (both 32 and 64 bit).

Supported libraries

The following libraries are currently supported:

Library

Module

Windows

Linux

CANlib

canlib.canlib

canlib32.dll

libcanlib.so

kvaMemoLibXML

canlib.kvamemolibxml

kvaMemoLibXML.dll

libkvamemolibxml.so

kvrlib

canlib.kvrlib

kvrlib.dll, irisdll.dll, irisflash.dll, libxml2.dll

not supported

kvmlib

canlib.kvmlib

kvaMemoLib0600.dll, kvaMemoLib0700.dll, kvaMemoLib.dll, kvmlib.dll

not supported, [2] libkvamemolib0700.so, libkvamemolib.so, libkvmlib.so

kvlclib

canlib.kvlclib

kvlclib.dll [1]

libkvlclib.so

kvaDbLib

canlib.kvadblib

kvaDbLib.dll

libkvadblib.so

LINlib

canlib.linlib

linlib.dll

liblinlib.so

Installation

Install the Python package from PyPI using e.g. pip:

$ pip install canlib

If you have downloaded the package zip file from the Kvaser Download page, first unzip pycanlib.zip. Then navigate to the unzipped pycanlib using the command line. It should contain the file canlib-x.y.z-py2.py3-none-any.whl, where x,y,z are version numbers. Run the following command:

$ pip install canlib-x.y.z-py2.py3-none-any.whl

The Kvaser CANlib DLLs or shared libraries also need to be installed:

Windows

On Windows, first install the canlib32.dll by downloading and installing “Kvaser Drivers for Windows” which can be found on the Kvaser Download page (kvaser_drivers_setup.exe) This will also install kvrlib.dll, irisdll.dll, irisflash.dll and libxml2.dll used by kvrlib.

The “Kvaser CANlib SDK” also needs to be downloaded from the same place (canlib.exe) and installed if more than just CANlib will be used. This will install the rest of the supported library dll’s.

The two packages, “Kvaser Drivers for Windows” and “Kvaser CANlib SDK”, contains both 32 and 64 bit versions of the included dll’s.

Linux

On Linux, first install the libcanlib.so by downloading and installing “Kvaser LINUX Driver and SDK” which can be found on the Kvaser Download page (linuxcan.tar.gz).

If more than just CANlib will be used, the rest of the supported libraries will be available by downloading and installing “Linux SDK library” (kvlibsdk.tar.gz).

Usage

Example of using canlib to list some information about connected Kvaser devices:

from canlib import canlib

num_channels = canlib.getNumberOfChannels()
print(f"Found {num_channels} channels")
for ch in range(num_channels):
    chd = canlib.ChannelData(ch)
    print(f"{ch}. {chd.channel_name} ({chd.card_upc_no} / {chd.card_serial_no})")

Which may result in:

Found 4 channels
0. Kvaser Memorator Pro 2xHS v2 (channel 0) (73-30130-00819-9 / 12330)
1. Kvaser Memorator Pro 2xHS v2 (channel 1) (73-30130-00819-9 / 12330)
2. Kvaser Virtual CAN Driver (channel 0) (00-00000-00000-0 / 0)
3. Kvaser Virtual CAN Driver (channel 1) (00-00000-00000-0 / 0)

Support

You are invited to visit the Kvaser web pages at https://www.kvaser.com/support/. If you don’t find what you are looking for, you can obtain support on a time-available basis by sending an e-mail to support@kvaser.com.

Bug reports, contributions, suggestions for improvements, and similar things are much appreciated and can be sent by e-mail to support@kvaser.com.

What’s new

A complete set of release notes are available in the package documentation included in the zip file available at the Kvaser Download page.

License

This project is licensed under the terms of the MIT license.

Project details


Download files

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

Source Distribution

canlib-1.31.107.tar.gz (176.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

canlib-1.31.107-py3-none-any.whl (204.8 kB view details)

Uploaded Python 3

File details

Details for the file canlib-1.31.107.tar.gz.

File metadata

  • Download URL: canlib-1.31.107.tar.gz
  • Upload date:
  • Size: 176.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for canlib-1.31.107.tar.gz
Algorithm Hash digest
SHA256 4a8ae68fde4cd3b2faac6318f12c43d26ef17cc0fd6ca23b9a782f462cafd1ee
MD5 4e02ec9cc6727c420d9c24884fe3a354
BLAKE2b-256 3b6382861b4e994f51d53710fbc5c6c8de69784747f460011ddc234ef2b46b26

See more details on using hashes here.

File details

Details for the file canlib-1.31.107-py3-none-any.whl.

File metadata

  • Download URL: canlib-1.31.107-py3-none-any.whl
  • Upload date:
  • Size: 204.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for canlib-1.31.107-py3-none-any.whl
Algorithm Hash digest
SHA256 1456879286069d15c57daa0e636bb94ec21266820b3daa95072734c16f95d33f
MD5 bb51e2ba1e612c2c3826e4686b76682b
BLAKE2b-256 09d0bf307ede491fd07566b3dab7cceac40b682c338d76f6552fb9c99b5b7d34

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page