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

Relative imports for kaitai structs do not work #168

Open
aronwk-aaron opened this issue Oct 12, 2023 · 2 comments
Open

Relative imports for kaitai structs do not work #168

aronwk-aaron opened this issue Oct 12, 2023 · 2 comments

Comments

@aronwk-aaron
Copy link

I'm trying to use relative imports with kaitai, which is a supported doc
however, I get file not found in the tmp directory when I try to do this
image

Here is the file I am trying to use:

meta:
  id: chat
  file-extension: worldchat
  endian: le
  imports:
  - ../header
seq:
  - id: packet_header
    type: header::data
  - id: chat_channel
    type: u1
    enum: chat_channel
  - id: unkonown2
    type: u2
  - id: message
    type: u4_wstr
enums:
  chat_channel:
    ....

This is the file structure:
image

Let me know if there's any other info that I can provide to help resolve this isse

@hello-adam
Copy link
Member

this is probably caused by the fact that the hobbits kaitai plugin prepares and compiles ksy data in a separate temporary folder. I think some people have had luck with compiling the dependency types first so that they are cached/available in the built-in Python interpreter (?). Obviously that's not a great solution, so I won't close this. Understanding some of the hackiness in the plugin might help get around limitations (or help you decide when not to try to do something in hobbits).

@aronwk-aaron
Copy link
Author

yeah, imports seems to be an overall hacky and unfinished feature of kaitai editor's viewers.
the official webIDE doesn't work with relative imports unless they are in the same directory (or you do a little song and dance and shuffle the files around a few times to get them to work) and the vscode plugin (which I think is unsupported at this point) also doesn't work with relative imports.

I didn't see any issues about it on here so I thought I would make one. I'm just trying to find a way to prototype and test locally quickly, which hobbits was my last hope lol
I really love the interface and design of it overall. so hopefully this can be fix in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants