nbdev_export fails - TypeError: _default_exp_() takes 3 positional arguments but 4 were given

124 views Asked by At

I'm very new with nbdev. I have created nbdev environment, worked on one notebook inside "nbs" folder. However, I had to organize the notebooks on "nbs" and I created new folder to contain some of these notebooks.
(for example, I have folder name "nbs" and then inside it I have several notebooks and folders such as "weather_scripts","astrology_scripts" , and each folder like this contais scripts or sometimes more fodlers with scripts).

Since then, when I try to visualize my documentation, with running this on bash:

nbdev_export && pip install ./ && nbdev_preview

I get error with export-

~(.venv) user@me:~/git/my_script$ nbdev_export
Traceback (most recent call last):

  File "/home/user/git/my_script/.venv/bin/nbdev_export", line 8, in <module>
    sys.exit(nbdev_export())
  File "/home/user/git/my_script/.venv/lib/python3.9/site-packages/fastcore/script.py", line 119, in _f
    return tfunc(**merge(args, args_from_prog(func, xtra)))
  File "/home/user/git/my_script/.venv/lib/python3.9/site-packages/nbdev/doclinks.py", line 137, in nbdev_export
    for f in files: nb_export(f)
  File "/home/user/git/my_script/.venv/lib/python3.9/site-packages/nbdev/export.py", line 49, in nb_export
    nb.process()
  File "/home/user/git/my_script/.venv/lib/python3.9/site-packages/nbdev/process.py", line 126, in process
    for proc in self.procs: self._proc(proc)
  File "/home/user/git/my_script/.venv/lib/python3.9/site-packages/nbdev/process.py", line 119, in _proc
    for cell in self.nb.cells: self._process_cell(proc, cell)
  File "/home/user/git/my_script/.venv/lib/python3.9/site-packages/nbdev/process.py", line 109, in _process_cell
    if f: self._process_comment(f, cell, cmd)
  File "/home/user/git/my_script/.venv/lib/python3.9/site-packages/nbdev/process.py", line 115, in _process_comment
    return proc(cell, *args)
TypeError: _default_exp_() takes 3 positional arguments but 4 were given~~

The only thing that was changed between the time it worked and stopped working was that I opened notebooks in a folder inside nbs. However, I don't understand the error, and I'm very new to nbdev, so, I'm looking for help to understand why do I get this error and how I can solve it , any idea will be helpful :)

1

There are 1 answers

0
Reut On

In the end the problem was inside one of the notebooks. The first block had problem with the deafult_exp:

##this is error:
#|default_exp my notebook

##this is correct (with _ and without space)
#|default_exp my_notebook

The way to debug it was to take out of nbs folder all the notebooks and then try one by one. I hope it will help someone...