mamba-org / boa

The fast conda package builder, based on mamba
https://boa-build.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
253 stars 57 forks source link

Open recipe in binary mode #353

Closed dhirschfeld closed 1 year ago

dhirschfeld commented 1 year ago

Just kicking the tyres on this one and running into:

Traceback (most recent call last):
  File "/opt/mambaforge/envs/bin/bin/boa", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/mambaforge/envs/bin/lib/python3.11/site-packages/boa/cli/boa.py", line 244, in main
    run_build(args)
  File "/opt/mambaforge/envs/bin/lib/python3.11/site-packages/boa/core/run_build.py", line 502, in run_build
    all_recipes = find_all_recipes(args.target, config, is_pyproject_recipe)  # [noqa]
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mambaforge/envs/bin/lib/python3.11/site-packages/boa/core/run_build.py", line 53, in find_all_recipes
    yml = render(fn, config=config, is_pyproject_recipe=is_pyproject_recipe)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mambaforge/envs/bin/lib/python3.11/site-packages/boa/core/render.py", line 177, in render
    ydoc = tomllib.load(fi)
           ^^^^^^^^^^^^^^^^
  File "/opt/mambaforge/envs/bin/lib/python3.11/tomllib/_parser.py", line 63, in load
    raise TypeError(
TypeError: File must be opened in binary mode, e.g. use `open('foo.toml', 'rb')`

...which looks like it's complaining about: https://github.com/mamba-org/boa/blob/54468bdd0f117cd09293791c0bda6e4457052ace/boa/core/render.py#L172

Originally posted by @dhirschfeld in https://github.com/mamba-org/boa/issues/345#issuecomment-1596095014