我想知道为什么会出现以下情况 xlOpenPort 失败 (XL_ERR_INVALID_CHANNEL_MASK)

问题描述

这是我正在尝试的代码

import can
bus = can.interface.Bus(channel=0,bustype = 'vector')

这是我按原样运行脚本时收到的错误错误

Traceback (most recent call last):
  File "C:/Users/xyz/Desktop/cantest2.py",line 2,in <module>
    bus = can.interface.Bus(channel=0,bustype = 'vector')
  File "C:\Users\xyz\AppData\Local\Programs\Python\python37\lib\site-packages\can\interface.py",line 127,in __new__
    return cls(channel,*args,**kwargs)
  File "C:\Users\xyz\AppData\Local\Programs\Python\python37\lib\site-packages\can\interfaces\vector\canlib.py",line 156,in __init__
    vxlapi.XL_INTERFACE_VERSION,vxlapi.XL_BUS_TYPE_CAN)
  File "C:\Users\xyz\AppData\Local\Programs\Python\python37\lib\site-packages\can\interfaces\vector\vxlapi.py",line 207,in check_status
    raise VectorError(result,xlGetErrorString(result).decode(),function.__name__)
can.interfaces.vector.exceptions.VectorError: xlOpenPort Failed (XL_ERR_INVALID_CHANNEL_MASK)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)