NotImplementedError: Invalid CAN Bus Type - None

简介: NotImplementedError: Invalid CAN Bus Type - None

连接can


can0 = can.interface.Bus(channel = ‘can0’, bustyp = ‘socketcan_ctypes’)


在python中连接can是会出现下列错误:


/

Traceback (most recent call last):
File “recv.py”, line 10, in
can1 = can.interface.Bus(channel = ‘can1’, bustyp = ‘socketcan_ctypes’)
File “/usr/local/lib/python3.7/dist-packages/can/interface.py”, line 108, in new
kwargs = load_config(config=kwargs, context=context)
File “/usr/local/lib/python3.7/dist-packages/can/util.py”, line 197, in load_config
raise NotImplementedError(‘Invalid CAN Bus Type - {}’.format(config[‘interface’]))
NotImplementedError: Invalid CAN Bus Type - None


解决方法:


在~/下添加 .canrc文件,


sudo vi ~/.canrc


里面填写如下信息


/

[default]
interface = socketcan
channel = can0


问题即可解决

相关文章
|
2月前
|
Go
panic:runtime error:invalid memory address or nil pointer dereference
panic:runtime error:invalid memory address or nil pointer dereference
|
6月前
Argument of type 'XX' is not assignable to parameter of type 'XX'
Argument of type 'XX' is not assignable to parameter of type 'XX'
117 0
|
人工智能 自然语言处理 语音技术
Invalid prop: type check failed for prop “index“. Expected String with value “5“问题解决
Invalid prop: type check failed for prop “index“. Expected String with value “5“问题解决
116 0
|
Scala
TYPE
TYPE
141 0
|
前端开发 数据库
Failed to load response dataNo data found for resource with given identifier
Failed to load response dataNo data found for resource with given identifier
1517 0
解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题
解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题
解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题
|
SQL 关系型数据库 数据库
[Err] ERROR: invalid input syntax for integer: "1.0"
[Err] ERROR: invalid input syntax for integer: "1.0"
1066 0
[Err] ERROR: invalid input syntax for integer: "1.0"