This is my sample Python 3 code.
from ctypes import create_string_buffer
import struct
...
# self.payload is None / max is integer
self.payload = create_string_buffer(max)
# self.payload is ctypes.c_char_Array_3
struct.pack_into(str(max) + "s", self.payload, 0, padding)
This is Error Code
struct.error: argument for 's' must be a bytes object
This sample code worked well in Python2 environment. However, the above error code was found during the conversion process to python3.
So, I forced conversion of self.payload to bytes(self.payload.raw) type results in the following Error Code.
TypeError: argumnet must be read-write bytes-like object, not bytes
How do we fix these errors and run them in a python3 environment?