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

nbdev_new fails with AttributeError: path_ #1063

Closed
lgonzalezsa opened this issue Sep 15, 2022 · 8 comments
Closed

nbdev_new fails with AttributeError: path_ #1063

lgonzalezsa opened this issue Sep 15, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@lgonzalezsa
Copy link

@seeM another issue with nbdev_new
I am running this versions:

fastcore                  1.5.26                     py_0    fastai
ghapi                     1.0.3                    pypi_0    pypi
nbdev                     2.3.2                     dev_0    <develop>
git clone [email protected]:enterprise/the_repo.git
Cloning into 'the_repo'...
remote: Enumerating objects: 1293, done.
remote: Counting objects: 100% (61/61), done.
remote: Compressing objects: 100% (44/44), done.
remote: Total 1293 (delta 10), reused 61 (delta 10), pack-reused 1232
Receiving objects: 100% (1293/1293), 79.61 MiB | 2.61 MiB/s, done.
Resolving deltas: 100% (787/787), done.
(dev_env) gonluisr@gonluisr-hp-zbook-15-g3:~/tmp$ cd the_repo/
(dev_env) gonluisr@gonluisr-hp-zbook-15-g3:~/tmp/the_repo$ nbdev_new
repo = the_repo # Automatically inferred from git
user = enterprise # Automatically inferred from git
author = Luis Rolando Gonzalez # Automatically inferred from git
author_email = [email protected] # Automatically inferred from git
description = To support Process Improvements # Automatically inferred from git
settings.ini created.
Traceback (most recent call last):
  File "/home/gonluisr/miniconda3/envs/dev_env/bin/nbdev_filter", line 33, in <module>
    sys.exit(load_entry_point('nbdev', 'console_scripts', 'nbdev_filter')())
  File "/home/gonluisr/miniconda3/envs/dev_env/lib/python3.10/site-packages/fastcore/script.py", line 119, in _f
    return tfunc(**merge(args, args_from_prog(func, xtra)))
  File "/home/gonluisr/github/nbdev/nbdev/cli.py", line 46, in nbdev_filter
    with redirect_stdout(dn): filt(nb)
  File "/home/gonluisr/github/nbdev/nbdev/processors.py", line 218, in __call__
    def __call__(self, nb): return self.nb_proc(nb).process()
  File "/home/gonluisr/github/nbdev/nbdev/process.py", line 126, in process
    for proc in self.procs: self._proc(proc)
  File "/home/gonluisr/github/nbdev/nbdev/process.py", line 120, in _proc
    if hasattr(proc,'end'): proc.end()
  File "/home/gonluisr/github/nbdev/nbdev/frontmatter.py", line 66, in end
    self.fm.update({'output-file': _nbpath2html(Path(self.nb.path_)).name})
  File "/home/gonluisr/miniconda3/envs/dev_env/lib/python3.10/site-packages/fastcore/basics.py", line 247, in __getattr__
    def __getattr__(self,k): return self[k] if k in self else stop(AttributeError(k))
  File "/home/gonluisr/miniconda3/envs/dev_env/lib/python3.10/site-packages/fastcore/basics.py", line 216, in stop
    raise e
AttributeError: path_
@seeM
Copy link
Member

seeM commented Sep 15, 2022

Do you have latest execnb too?

@seeM
Copy link
Member

seeM commented Sep 15, 2022

Although I think path_ was added to notebooks in execnb.nbio.read_nb in 0.0.6 which is a few months old (via fastai/execnb@f6a2808)

@seeM
Copy link
Member

seeM commented Sep 15, 2022

Sorry, ignore above messages, I can repro this locally. Looking into it!

@lgonzalezsa
Copy link
Author

oh ok, but yes I do have execnb 0.1.3

execnb                    0.1.3                      py_0    fastai
fastcore                  1.5.26                     py_0    fastai
ghapi                     1.0.3                    pypi_0    pypi
nbdev                     2.3.2                     dev_0    <develop>

@seeM seeM changed the title nbdev_new | AttributeError: path_ | GitHub Enterprise nbdev_new fails with AttributeError: path_ Sep 15, 2022
@seeM seeM added the bug Something isn't working label Sep 15, 2022
@jph00 jph00 closed this as completed in 2f8a875 Sep 15, 2022
jph00 added a commit that referenced this issue Sep 15, 2022
fix #1063: ignore `_quarto.yml` from `nbdev-template`
@lgonzalezsa
Copy link
Author

I did git pull and pip install -e nbdev again to check, but not sure if I am doing something wrong because still failing:

nbdev_new
repo = the_repo # Automatically inferred from git
user = enterprise # Automatically inferred from git
author = Luis Rolando Gonzalez # Automatically inferred from git
author_email = [email protected] # Automatically inferred from git
description = To support Process Improvements # Automatically inferred from git
/home/gonluisr/github/nbdev/nbdev/config.py:173: UserWarning: Config file already exists: /home/gonluisr/tmp/the_repo/settings.ini and will be used as a base
  if cfg.config_file.exists(): warn(f'Config file already exists: {cfg.config_file} and will be used as a base')
settings.ini created.
Traceback (most recent call last):
  File "/home/gonluisr/miniconda3/envs/dev_env/bin/nbdev_filter", line 33, in <module>
    sys.exit(load_entry_point('nbdev', 'console_scripts', 'nbdev_filter')())
  File "/home/gonluisr/miniconda3/envs/dev_env/lib/python3.10/site-packages/fastcore/script.py", line 119, in _f
    return tfunc(**merge(args, args_from_prog(func, xtra)))
  File "/home/gonluisr/github/nbdev/nbdev/cli.py", line 46, in nbdev_filter
    with redirect_stdout(dn): filt(nb)
  File "/home/gonluisr/github/nbdev/nbdev/processors.py", line 218, in __call__
    def __call__(self, nb): return self.nb_proc(nb).process()
  File "/home/gonluisr/github/nbdev/nbdev/process.py", line 126, in process
    for proc in self.procs: self._proc(proc)
  File "/home/gonluisr/github/nbdev/nbdev/process.py", line 120, in _proc
    if hasattr(proc,'end'): proc.end()
  File "/home/gonluisr/github/nbdev/nbdev/frontmatter.py", line 66, in end
    self.fm.update({'output-file': _nbpath2html(Path(self.nb.path_)).name})
  File "/home/gonluisr/miniconda3/envs/dev_env/lib/python3.10/site-packages/fastcore/basics.py", line 247, in __getattr__
    def __getattr__(self,k): return self[k] if k in self else stop(AttributeError(k))
  File "/home/gonluisr/miniconda3/envs/dev_env/lib/python3.10/site-packages/fastcore/basics.py", line 216, in stop
    raise e
AttributeError: path_

@seeM
Copy link
Member

seeM commented Sep 15, 2022

Remove the _quarto.yml file before you run nbdev_new

@lgonzalezsa
Copy link
Author

lgonzalezsa commented Sep 15, 2022

Yes, removing that file the nbdev_new command completes with no issues.
Also, with fresh new empty repo works as well.

nbdev_new
repo = the_repo # Automatically inferred from git
user = enterprise # Automatically inferred from git
author = Luis Rolando Gonzalez # Automatically inferred from git
author_email = [email protected] # Automatically inferred from git
description = To support Process Improvements # Automatically inferred from git
/home/gonluisr/github/nbdev/nbdev/config.py:173: UserWarning: Config file already exists: /home/gonluisr/tmp/the_repo/settings.ini and will be used as a base
  if cfg.config_file.exists(): warn(f'Config file already exists: {cfg.config_file} and will be used as a base')
settings.ini created.
pandoc -o README.md
  to: gfm+footnotes+tex_math_dollars-yaml_metadata_block
  output-file: index.html
  standalone: true
  default-image-extension: png
  
metadata
  description: To support Process Improvements
  title: the_repo
  
Output created: _docs/README.md

@ew-meetup
Copy link
Contributor

Can confirm. I ran into this when updating an existing repo.

Traceback (most recent call last):
  File "/usr/local/bin/nbdev_filter", line 8, in <module>
    sys.exit(nbdev_filter())
  File "/usr/local/lib/python3.7/site-packages/fastcore/script.py", line 119, in _f
    return tfunc(**merge(args, args_from_prog(func, xtra)))
  File "/usr/local/lib/python3.7/site-packages/nbdev/cli.py", line 46, in nbdev_filter
    with redirect_stdout(dn): filt(nb)
  File "/usr/local/lib/python3.7/site-packages/nbdev/processors.py", line 231, in __call__
    def __call__(self, nb): return self.nb_proc(nb).process()
  File "/usr/local/lib/python3.7/site-packages/nbdev/process.py", line 126, in process
    for proc in self.procs: self._proc(proc)
  File "/usr/local/lib/python3.7/site-packages/nbdev/process.py", line 120, in _proc
    if hasattr(proc,'end'): proc.end()
  File "/usr/local/lib/python3.7/site-packages/nbdev/frontmatter.py", line 66, in end
    self.fm.update({'output-file': _nbpath2html(Path(self.nb.path_)).name})
  File "/usr/local/lib/python3.7/site-packages/fastcore/basics.py", line 247, in __getattr__
    def __getattr__(self,k): return self[k] if k in self else stop(AttributeError(k))
  File "/usr/local/lib/python3.7/site-packages/fastcore/basics.py", line 216, in stop
    raise e
AttributeError: path_

removing the _quatro.yml file (from an older nbdev2 version ?) and running nbdev_migrate resolved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants