import os import struct LDD_INSTALL_PATH = r'C:\Program Files (x86)\LEGO Company\LEGO Digital Designer' LDD_ASSET_PATH = os.path.join(LDD_INSTALL_PATH, 'Assets.lif') def read(): def uint32(fd, offset): fd.seek(offset) buff = fd.read(4) if bytesAre == 'str': return (ord(buff[0]) * 16777216) + \ (ord(buff[1]) * 65536) + \ (ord(buff[2]) * 256) + \ ord(buff[3]) else: return (buff[0] * 16777216) + \ (buff[1] * 65536) + \ (buff[2] * 256) + \ buff[3] def uint16(fd, offset): fd.seek(offset) buff = fd.read(2) if bytesAre == "str": return (ord(buff[0]) * 256) + \ ord(buff[1]) else: return (fd.read(1) * 256) + \ fd.read(1) def recurse(fd, prefix, offset): if prefix == "": offset += 36 else: folder_list.extend([prefix]) offset += 4 for i in range(uint32(fd, offset)): offset += 4 entryType = uint16(fd, offset) # 1 = directory, 2 = file print 'xxx', entryType, offset offset += 6 # Build the name.offset entryName = os.sep while True: fd.seek(offset) read_chr = ''.join(struct.unpack('