0

I am trying to replay a log file using the following code. It's a very simple code to read each signal from the file and create the command. It is creating the command correctly. I print it to check and it works fine, but when I use os.system(command) to simulate VCAN it freezes and doesn't show the command on the terminal.

import os

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

print(command) 
os.system(command)

I am using Ubuntu 64-bit (vmWare) on my Mac. This code works fine on Raspberry Pi. And I installed the folllowings: Socketcan and sudo apt-get install can-utils and pip3 install cantools. And I bring the virtual can interface by

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

To test the interface, when I put this cansend vcan0 123#1122334455667788 on the command line, doesn't give me any errors. So probably something is wrong with os.system(command), although I checked it by sending other commands. I wonder if I missed isntalling any other libraries in order to use it on Ubuntu (vmWare).

Any help would be great. Thanks

Sarah
  • 133
  • 11
  • 1
    I have used a similar setup without any problem. You have all the required package and the initialization of the vcan interface is fine. What happen if you start a python console and just run `os.system("cansend vcan0 123#1122334455667788")`? And what happen if you remove `os.system(command)` in your script and just leave `print(command)`? Is the command what you expect to be? – William Spinelli May 31 '20 at 12:47
  • Something was wrong with the network. It is working now. Thanks – Sarah Jun 09 '20 at 02:37

0 Answers0