Erorr exporting notebook to script in kaggle

Trying to follow Lesson 2,exportign the notebook to a script.

!pip install nbdev
import nbdev
nbdev.export.nb_export(‘dog-cat.ipynb’, ‘dog-cat’)

I’ve also tried:

import os
cwd = os.getcwd()
nbdev.export.nb_export(cwd + ‘/dog-cat.ipynb’, ‘dog-cat’)

I get:

FileNotFoundError: [Errno 2] No such file or directory: ‘dog-cat.ipynb’

My noteboook name is dog-cat. The complete notebook can be found here:

Hey Thomas :wave:

I think your notebook is being stored as a different name.

Run the following in your notebook to list the files in your Kaggle environment:

system("ls")

Let me know if you have any issues. :slightly_smiling_face:

Thanks. The notebook indeed appears to be saved under a different name. But I’m still unable to export, when I use the seemingly correct name, nothing happens:

import nbdev
import os
cwd = os.getcwd()
os.listdir() # shows [‘notebook_source.ipynb’, ‘.virtual_documents’]
nbdev.export.nb_export(cwd + ‘/notebook_source.ipynb’, ‘dog-cat’)
os.listdir() # shows the same, no new file

I copied your notebook and it worked when I ran:

nbdev.export.nb_export('./__notebook_source__.ipynb')