-
Notifications
You must be signed in to change notification settings - Fork 651
Closed
Labels
Description
I am trying to implement a rest bus simulation using the library.
To debug if the code is correct, I use the trace window in CANoe application to check the messages.
Currently, I am trying to send CAN messages on the virtual CAN bus.
The following is the starting code which is supposed to send a message on the virtual CAN.
import can
def send_one():
with can.interface.Bus() as bus:
bus = can.interface.Bus(bustype='virtual', app_name='SelfApp', channel=[0])
msg = can.Message(arbitration_id=0xC0FFEE, data=[0, 25, 0, 1, 3, 1, 4, 1], is_extended_id=True)
try:
bus.send(msg)
print(f"Message sent on {bus.channel_info}")
except can.CanError:
print("Message NOT sent")
if __name__ == "__main__":
send_one()
I get the following error:
File ".../SendMsg.py", line 51, in <module>
send_one()
File ".../SendMsg.py", line 30, in send_one
with can.interface.Bus() as bus:
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\python_can-3.3.2-py3.6.egg\can\interface.py", line 108, in __new__
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\python_can-3.3.2-py3.6.egg\can\util.py", line 197, in load_config
NotImplementedError: Invalid CAN Bus Type - None```
Can someone please help me to remove this error?