如何修复JetsonTX2容器上协议不支持的OSError:[Errno 97]地址族?

2024-09-24 00:31:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图在docker容器内的Jetson TX2板(arm架构,如果需要的话)上使用这个库can-isotp

如果我从文档中测试以下代码:

import isotp

s = isotp.socket()
s2 = isotp.socket()
# Configuring the sockets.
s.set_fc_opts(stmin=5, bs=10)

s.bind("vcan0", isotp.Address(rxid=0x123 txid=0x456))
s2.bind("vcan0", isotp.Address(rxid=0x456, txid=0x123))
s2.send(b"Hello, this is a long payload sent in small chunks of 8 bytes.")
print(s.recv())

我收到以下错误消息:

root@d1a297bae985:/# python3.7 test.py Traceback (most recent call last): File "test.py", line 3, in s = isotp.socket() File "/usr/local/lib/python3.7/site-packages/isotp/tpsock/init.py", line 74, in init self._socket = socket_module.socket(socket_module.AF_CAN, socket_module.SOCK_DGRAM, socket_module.CAN_ISOTP) File "/usr/local/lib/python3.7/socket.py", line 151, in init _socket.socket.init(self, family, type, proto, fileno) OSError: [Errno 97] Address family not supported by protocol

我已经在网上搜索过了,但在这方面没有找到任何帮助。我不知道为什么它不工作(它以前在RPI3上工作过)。Ifconfig显示两个接口,即can0和can1

我真的很感激任何帮助


Tags: inpytestinitbindaddresslinesocket