Maximum Bytes Transmission

How can I change the maximum bytes allowed from host to target to exceed 256?
Error:data = bytearray(data)
ValueError: byte must be in range(0, 256).

Thanks

I tried to play around with the Simple Serial2.py in the capture/target by changing the write in line 620

    def write(self, data):
        print(data)
        if type(data) is list:
            byte_array = bytearray()
            for value in data:
                # Use 'I' format for packing an unsigned integer (4 bytes)
                packed_bytes = struct.pack('I', value)
                byte_array.extend(packed_bytes)
            data=byte_array
            #data = bytearray(data)
        self.ser.write(data)

However since I am passing 3000 bytes the array passed as data in this stage contains this number. [2, 103, 2, 3132, 1, 1, 1, 1, 1,… so still gives me the same error. Can you please advise?

Thanks,
Hana