Usually this library is used with a particular CAN interface, this can be specified in code, read from configuration files or environment variables.
can.util.load_config() for implementation.
can object exposes an
rc dictionary which can be used to set
the interface and channel before importing from
import can can.rc['interface'] = 'socketcan' can.rc['channel'] = 'vcan0' from can.interfaces.interface import Bus bus = Bus()
On Linux systems the config file is searched in the following paths:
On Windows systems the config file is searched in the following paths:
can.ini (current working directory)
The configuration file sets the default interface and channel:
[default] interface = <the name of the interface to use> channel = <the channel to use by default>
Configuration can be pulled from these environmental variables: