0

我正在尝试使用以下代码重播日志文件。从文件中读取每个信号并创建命令是一个非常简单的代码。它正在正确创建命令。我打印它进行检查,它工作正常,但是当我 os.system(command)用来模拟 VCAN 时它会冻结并且不会在终端上显示命令。

import os

filename = "canLogs.log"
f = open(filename, "r")
...
(Reading logs from file and create "command")
...

print(command) 
os.system(command)

我在我的 Mac 上使用 Ubuntu 64 位 (vmWare)。此代码在 Raspberry Pi 上运行良好。我安装了以下内容: Socketcanandsudo apt-get install can-utilspip3 install cantools. 我带来了虚拟罐接口

sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set vcan0 up

为了测试界面,当我把它cansend vcan0 123#1122334455667788放在命令行上时,不会给我任何错误。所以可能有问题os.system(command),尽管我通过发送其他命令进行了检查。我想知道我是否错过了安装任何其他库以便在 Ubuntu (vmWare) 上使用它。

任何帮助都会很棒。谢谢

4

0 回答 0