Skip to content

nbdev_readme() fails on the second run for the notebook with support files (e.g. Fig image). #1106

Closed
@nueshym

Description

@nueshym

Minimal setup to reproduce this error:
https://github.com/nueshym/nbdev_readme_error/blob/main/nbdev_readme_test.ipynb

Problem

Executing nbdev_readme() while there's already exported support files folder exists at root directory cause:

FileExistsError: [Errno 17] File exists: '<abs_path_to_root>/index_files'

At https://github.com/fastai/nbdev/blob/8cf8d257ae1ba24bacb5f5a82910772959c5bc4f/nbdev/quarto.py#L217

Expected behaviour

README.md and support files are exported to root directory.

Actual behaviour

support files are not exported.

Solution

Check if the directory exists before copytree.

...

And there's another weird bug closely related to this one:
You can't use readme.ipynb for readme_nb.
failed with:

ERROR: NotFound: No such file or directory (os error 2)

Seems the name readme conflicting with something at quarto or pandoc level.
I will submit as an another issue if you want but that requires another fresh project to reproduce...

Thanks for great project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions