mcbeet / beet

The Minecraft pack development kit.
https://mcbeet.dev
MIT License
141 stars 15 forks source link

`Datapack.save(overwrite=True)` raises `FileNotFoundError` when trying to save different data than what's already written on disk. #443

Open Belissimo-T opened 4 months ago

Belissimo-T commented 4 months ago

The title says it all.

Traceback (most recent call last):
  File "[...]/mcutils3/mcutils/ir/datapack.py", line 43, in export
    out.save(overwrite=True)
  File "[...]/mcutils3/venv/lib/python3.12/site-packages/beet/library/base.py", line 1509, in save
    self.dump(pack)
  File "[...]/mcutils3/venv/lib/python3.12/site-packages/beet/library/base.py", line 1445, in dump
    _dump_files(origin, self.list_files())
  File "[...]/mcutils3/venv/lib/python3.12/site-packages/beet/library/base.py", line 1531, in _dump_files
    f.dump(origin, "/".join(directory + (filename,)))
  File "[...]/mcutils3/venv/lib/python3.12/site-packages/beet/core/file.py", line 313, in dump
    shutil.copyfile(self.ensure_source_path(), str(Path(origin, path)))
  File "/usr/lib/python3.12/shutil.py", line 260, in copyfile
    with open(src, 'rb') as fsrc:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '[...]/mcutils3/testout/test/data/test/functions/exists/1_score_639_3.mcfunction'

I think it only happens when it needs to create different subfolders than what's already written to disk. Stangely enough, once I run my program a second time, it always works. When just invoking the function twice, however, it still fails.

PS: Thanks for this awesome library!