Instance values are lazy loaded and thus not available via __dict__
Kaitai Instance values are lazy loaded, and thus not available as attributes of the parent object using the special __dict__
attribute.
Example:
# Frame from Fox-1A
frame_hex = '911878d33810000000e60a000000000000001799917b89915d3941507cc643dcc6235cca4b6b03801998ecca430ed37d3c486d127ff9010123001638ac000020'
frame = binascii.unhexlify(frame_hex)
struct = decode_frame(args.decoder_name, frame)
print('Attributes available via __dict__:\n{}'.format(struct.fox_raw.fox_hdr.__dict__))
print('fox_id: {}'.format(struct.fox_raw.fox_hdr.fox_id))
Output:
Attributes available via __dict__:
{'_io': <kaitaistruct.KaitaiStream object at 0x7fa792ad2a90>, '_parent': <py2_decoders.fox.FoxFrame object at 0x7fa792ad2a50>, '_root': <py2_decoders.fox.Fox object at 0x7fa792ad29d0>, 'b': [145, 24, 120, 211, 56, 16], '_m_fox_frm_type': 1}
fox_id: 1
- kaitai struct: fox_masked.ksy by @DL4PD
- generated decoder: fox.py
edit: Added link to ksy and generated decoder
Edited by Fabian P. Schmidt