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

No such file or directory: '' #18

Open
nick-youngblut opened this issue Aug 13, 2024 · 0 comments
Open

No such file or directory: '' #18

nick-youngblut opened this issue Aug 13, 2024 · 0 comments

Comments

@nick-youngblut
Copy link

Thanks for making the package! I'm finding it very useful for LLM-agent based manipulations of Jupyter notebooks.

I ran into a bug with to_md:

{
	"name": "FileNotFoundError",
	"message": "[Errno 2] No such file or directory: ''",
	"stack": "---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[33], line 1
----> 1 nb.to_md(\"new_markdown.md\")

File ~/miniforge3/envs/notebook-helper/lib/python3.11/site-packages/nbmanips/notebook/notebook_mixins.py:361, in ExportMixin.to_md(self, path, exclude_code_cell, exclude_markdown, exclude_raw, exclude_unknown, exclude_input, exclude_output, **kwargs)
    338 def to_md(
    339     self,
    340     path,
   (...)
    347     **kwargs,
    348 ):
    349     \"\"\"
    350     Exports to a markdown document (.md)
    351 
   (...)
    359     :param kwargs: exclude_input_prompt, exclude_output_prompt, ...
    360     \"\"\"
--> 361     return self.nbconvert(
    362         \"markdown\",
    363         path,
    364         exclude_code_cell=exclude_code_cell,
    365         exclude_markdown=exclude_markdown,
    366         exclude_raw=exclude_raw,
    367         exclude_unknown=exclude_unknown,
    368         exclude_input=exclude_input,
    369         exclude_output=exclude_output,
    370         **kwargs,
    371     )

File ~/miniforge3/envs/notebook-helper/lib/python3.11/site-packages/nbmanips/notebook/notebook_mixins.py:291, in ExportMixin.nbconvert(self, exporter_name, path, template_name, *args, **kwargs)
    288 if ext:
    289     resources.pop(\"output_extension\")
--> 291 writer.write(body, resources, file_name)

File ~/miniforge3/envs/notebook-helper/lib/python3.11/site-packages/nbconvert/writers/files.py:112, in FilesWriter.write(self, output, resources, notebook_name, **kw)
    107 if items:
    108     self.log.info(
    109         \"Support files will be in %s\",
    110         os.path.join(resources.get(\"output_files_dir\", \"\"), \"\"),
    111     )
--> 112     self._write_items(items, build_directory)
    114 # Write the extracted attachments
    115 # if ExtractAttachmentsOutput specified a separate directory
    116 attachments = resources.get(\"attachments\", {}).items()

File ~/miniforge3/envs/notebook-helper/lib/python3.11/site-packages/nbconvert/writers/files.py:73, in FilesWriter._write_items(self, items, build_dir)
     71 dest = os.path.join(build_dir, filename)
     72 path = os.path.dirname(dest)
---> 73 self._makedir(path)
     75 # Write file
     76 self.log.debug(\"Writing %i bytes to %s\", len(data), dest)

File ~/miniforge3/envs/notebook-helper/lib/python3.11/site-packages/nbconvert/writers/files.py:60, in FilesWriter._makedir(self, path, mode)
     58 self.log.info(\"Making directory %s\", path)
     59 try:
---> 60     os.makedirs(path, mode=mode)
     61 except OSError as e:
     62     if e.errno != errno.EEXIST:

File <frozen os>:225, in makedirs(name, mode, exist_ok)

FileNotFoundError: [Errno 2] No such file or directory: ''"
}

It appears that you are assuming that the directory in the file path (os.path.dirname) is not blank.

I'm using nbmanips 2.1.0.

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

1 participant