Problem with nbdev and notebook2script

Hi, I have a problem with nbdev and notebook2script . I have installed the following versions: nbdev 2.3.6; notebook2script 0.2.1.
When I try to run from nbdev.export import notebook2script I get the following error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Input In [30], in <cell line: 1>()
----> 1 from nbdev.export import notebook2script

ImportError: cannot import name 'notebook2script' from 'nbdev.export' (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nbdev/export.py)

Has anyone solved this problem?
Thanks

You may want to refer the migration guide especially update directive names nbdev - nbdev1 Migration

As suggested here:

import nbdev
nbdev.export.nb_export('app.ipynb', 'app')
print('Export successful')
2 Likes

Thank you @chrwittm, I had trouble with that! :slightly_smiling_face:
I’ll add that the 2nd parameter to nb_export is the directory path and not the filename, so if you wish to create the Python file directly in the same dir as your notebook, you can do this:
nbdev.export.nb_export('app.ipynb', './')

3 Likes