On Wednesday, November 13, 2013 3:41:03 PM UTC-5, krishna...@gmail.com wrote: > Thanks for your reply Ned! > > I tried this your suggestion and this is what it complains... > > os_inst_bytes = struct.pack('7BI512s', 0, 0x51, 0x10, 5, 0, 0xD, 0x80, 0, '') > > --------------------------------------------------------------------------- > error > Traceback (most recent call last) > <ipython-input-6-d36f45a8d3e6> in <module>() > ----> 1 os_inst_bytes = struct.pack('7BI512s', 0, 0x51, 0x10, 5, 0, 0xD, > 0x80, 0, "") > > error: argument for 's' must be a bytes object >
OK, looks like you are using Python 3 (it helps to specify these things up-front). Use b"" to get an empty byte-string. > In [7]: > > > And about the bytearray() call, I want to pass a mutable object to the IOCTL > to be able to get the data back from the driver. Without bytearray(), the > ioctl with mutable flag set to 1 would complain. OK, keep the bytearray call if it helps. --Ned. -- https://mail.python.org/mailman/listinfo/python-list