2 Channel CAN BUS FD Shield for Raspberry Pi send data with python, bytearray issue

Hello

I have raspberry pi 4 and 2 Channel CAN BUS FD Shield from seeed.
I can read can message from car But i have issue send message to car about bytearray with python.

This is my code:
MES=“00 00 fe 80 01 f0 00”
MES=MES.rstrip()

DLC=“8”
DLC_sayi=int(DLC)

ID=“0440”

bustype = ‘socketcan_native’
channel = ‘can0’
“”":param id: Spam the bus with messages including the data id."""
bus = can.interface.Bus(channel=channel, bustype=bustype)
msg = can.Message(arbitration_id=0xc0ffee, data=[ID, DLC_sayi, b], extended_id=False)
bus.send(msg)
# Issue #3: Need to keep running to ensure the writing threads stay alive. ?
time.sleep(1)

Fault is:
bytearray(b’00 00 00 fe 80 01 f0 00’)
Traceback (most recent call last):
File “/usr/local/lib/python3.7/dist-packages/can/message.py”, line 129, in init
self.data = bytearray(data)
TypeError: ‘str’ object cannot be interpreted as an integer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/pi/Desktop/can/can_gonder_2.py”, line 50, in
msg = can.Message(arbitration_id=0xc0ffee, data=[ID, DLC_sayi, b], extended_id=False)
File “/usr/local/lib/python3.7/dist-packages/can/message.py”, line 132, in init
raise TypeError(err)

Please tell me what should i type ID, DLC, MESSAGE(byte), arbitration_id ?
which type arbitration type? is it message ID or const value?
DLC is integer or byte or string which one ?
MESSAGE is byte or byte array or string which one?

Thanks for advance.

It seems to be a python syntax problem.Perhaps the wiki code can provide you with more references.

The wiki page at

is out of date for Python.

  1. Go to python-can — python-can 4.0.0 documentation to get the latest.
  2. The network open must now be used with a ‘with’ statement or the interface will never close properly.
  3. ‘socketcan_native’ no longer works, use ‘socketcan’

There is likely more, I am still debugging.