Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imports not generating working Python code #1000

Closed
bersbersbers opened this issue Nov 14, 2022 · 2 comments
Closed

imports not generating working Python code #1000

bersbersbers opened this issue Nov 14, 2022 · 2 comments

Comments

@bersbersbers
Copy link

payload.ksy:

meta:
  id: payload
  imports:
    - utility
seq:
  - id: packets
    type: utility::packet_t
    repeat: eos

utility.ksy:

meta:
  id: utility
types:
  packet_t:
    seq:
      - id: packet
        type: u1
kaitai-struct-compiler.bat payload.ksy -t python
python -c "from payload import Payload; Payload.from_file('payload.py')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\bers\.pyenv\pyenv-win\versions\3.11.0\Lib\site-packages\kaitaistruct.py", line 44, in from_file
    return cls(KaitaiStream(f))
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Code\kaitai\payload.py", line 15, in __init__
    self._read()
  File "C:\Code\kaitai\payload.py", line 21, in _read
    self.packets.append(Utility.PacketT(self._io, self, self._root))
                        ^^^^^^^
NameError: name 'Utility' is not defined
@bersbersbers
Copy link
Author

Sounds a lot like #703. ks-opaque-types: true does not help.

@generalmimon
Copy link
Member

Duplicate of #703

@generalmimon generalmimon marked this as a duplicate of #703 Nov 14, 2022
@generalmimon generalmimon closed this as not planned Won't fix, can't repro, duplicate, stale Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants