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

yml_to_byml does not support empty documents #21

Open
davidzchen opened this issue Jun 20, 2024 · 1 comment
Open

yml_to_byml does not support empty documents #21

davidzchen opened this issue Jun 20, 2024 · 1 comment

Comments

@davidzchen
Copy link
Contributor

According to the documentation on ZeldaMods, empty BYML documents are supported. In this case, the offset to root node would be 0 if the document is completely empty.

However, yml_to_byml throws an error when the input YAML document is empty:

$ touch empty.yml
$ yml_to_byml empty.yml ./empty.byml
Traceback (most recent call last):
  File "/Users/dzc/.local/venv/bin/yml_to_byml", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/dzc/.local/venv/lib/python3.12/site-packages/byml/yml_to_byml.py", line 27, in main
    byml.Writer(root, be=args.be, version=args.version).write(buf)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dzc/.local/venv/lib/python3.12/site-packages/byml/byml.py", line 232, in __init__
    raise ValueError("Data should be a dict or a list")
ValueError: Data should be a dict or a list
@leoetlino
Copy link
Member

Sounds easy to fix - we should relax the "data should be dict or list" check to also allow None.

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