Python error using WriteToPipeIn and ReadFromPipeOut

I updated to FrontPanel 4.2.5 which includes the Python 3.2 API and am trying to recreate the DESTester program in Python from the Cxx source code. It initializes the FPGA fine, but when I get to the function calls WriteToPipeIn and ReadFromPipeOut, I get a type error. I am using the following syntax:

buf = “\x00”*2048 # As an example buffer.
xem.WriteToPipeIn(0x80, buf)

In the console, it gives me the type error:

File “ok.py”, line 593, in WriteToPipeIn
def WriteToPipeIn(self, *args): return _ok.okCFrontPanel_WriteToPipeIn(self, *args)
TypeError: in method ‘okCFrontPanel_WriteToPipeIn’, argument 3 of type ‘(char *data, int length)’

A similar error is given for ReadFromPipeOut:

buf = “\x00”*2048 # As an example buffer.
xem.ReadFromPipeOut(0xA0, buf)

File “ok.py”, line 594, in ReadFromPipeOut
def ReadFromPipeOut(self, *args): return _ok.okCFrontPanel_ReadFromPipeOut(self, *args)
TypeError: in method ‘okCFrontPanel_ReadFromPipeOut’, argument 3 of type ‘(char *data, int length)’

Any idea what’s wrong?

I found my mistake. The buffer needs to be a bytearray which is mutable vs. an immutable string. Changing the code to the following fixed the problem:

buf = bytearray("\x00"*2048)
xem.WriteToPipeIn(0x80, buf)