I bumped into an error where when using a Python generated with the .ksy I would get an error: "ConstantPoolEntry' object has no attribute 'tag' for the second entry of entries that take up two entries (long and double).
The generated code looks like this:
@property
def is_two_entries(self):
if hasattr(self, '_m_is_two_entries'):
return self._m_is_two_entries if hasattr(self, '_m_is_two_entries') else None
self._m_is_two_entries = ((self.tag == JavaClass.ConstantPoolEntry.TagEnum.long) or (self.tag == JavaClass.ConstantPoolEntry.TagEnum.double))
return self._m_is_two_entries if hasattr(self, '_m_is_two_entries') else None
The problem here is that it tries to find self.tag which doesn't exist for these "second entries":
def _read(self):
if not (self.is_prev_two_entries):
self.tag = KaitaiStream.resolve_enum(JavaClass.ConstantPoolEntry.TagEnum, self._io.read_u1())
As you can see self.tag does not exist for these entries.
I bumped into an error where when using a Python generated with the
.ksy
I would get an error:"ConstantPoolEntry' object has no attribute 'tag'
for the second entry of entries that take up two entries (long
anddouble
).The generated code looks like this:
The problem here is that it tries to find
self.tag
which doesn't exist for these "second entries":As you can see
self.tag
does not exist for these entries.In the Web IDE this is not a problem.