bvanheu / stratatools

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

stratasys-ng is broken in a specific case #2

Closed bvanheu closed 10 years ago

bvanheu commented 10 years ago

See the next lines:

$ ./stratasys-cli.py info -t prodigy -e 23747906010000d0 -i test.bin -u -r
Traceback (most recent call last):
File "./stratasys-cli.py", line 168, in 
app.run()
File "./stratasys-cli.py", line 46, in run
args.func(args)
File "./stratasys-cli.py", line 133, in command_info
cartridge = m.decode(machine_number, args.eeprom_uid, cartridge_crypted)
File "/home/parallels/stratasys/stratasys/manager.py", line 76, in decode
cartridge_packed = self.decrypt(machine_number, eeprom_uid, cartridge_crypted)
File "/home/parallels/stratasys/stratasys/manager.py", line 220, in decrypt
if self.checksum.checksum(cartridge_crypted[0x00:0x40]) != struct.unpack("<H", cartridge_crypted[0x46:0x48])[0]:
struct.error: unpack requires a string argument of length 2
bvanheu commented 10 years ago

Actually it's not broken on x64, but i don't understand why that error occured for someone.

bvanheu commented 10 years ago

The problem occurs when using python 2.7.3, the 'struct' module doesn't support the bytearray interface. The bug is fixed in python 2.7.4+. You can temporary fix this issue by casting to str() before unpacking the data.

I'll fix the problem soon.