bvanheu / stratatools

Stratasys EEPROM tool
BSD 3-Clause "New" or "Revised" License
88 stars 40 forks source link

TypeError: unpack_from() argument 1 must be string or read-only buffer, ... #14

Open bigner opened 9 years ago

bigner commented 9 years ago

...not bytearray

Fixes an error with manager.py causing the following error.

~/stratasys $ ./stratasys-cartridge.py info --machine-type prodigy --eeprom-uid d1000000a8ae2523 -i new_eeprom.bin Traceback (most recent call last): File "./stratasys-cartridge.py", line 204, in app.run() File "./stratasys-cartridge.py", line 47, in run args.func(args) File "./stratasys-cartridge.py", line 134, in command_info cartridge = m.decode(machine_number, args.eeprom_uid, cartridge_crypted) File "/home/pi/stratasys/stratasys/manager.py", line 74, in decode cartridge = self.unpack(cartridge_packed) File "/home/pi/stratasys/stratasys/manager.py", line 137, in unpack serial_number = struct.unpack_from("<d", cartridge_packed, 0x0)[0] TypeError: unpack_from() argument 1 must be string or read-only buffer, not bytearray

bvanheu commented 9 years ago

Hi, thanks for your patch.

Which version of python are you using? <= 2.7.3 I guess?

bigner commented 9 years ago

Correct. Running 2.7.3 on Raspberry PI. Took a while to figure it out.

toma678 commented 8 years ago

Can confirm patch works.