Skip to content

.get instead of acessing attr #1023

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

Closed
wants to merge 1 commit into from
Closed

.get instead of acessing attr #1023

wants to merge 1 commit into from

Conversation

hamelsmu
Copy link
Contributor

@hamelsmu hamelsmu commented Sep 9, 2022

I get the error when I create a new repo and save any notebook

[E 2022-09-09 11:37:30.031 ServerApp] Pre-save hook failed on Untitled.ipynb
    Traceback (most recent call last):
      File "/Users/hamel/opt/anaconda3/lib/python3.9/site-packages/jupyter_server/services/contents/manager.py", line 134, in run_pre_save_hook
        self.pre_save_hook(model=model, path=path, contents_manager=self, **kwargs)
      File "/Users/hamel/.jupyter/jupyter_server_config.py", line 4, in nbdev_clean_jupyter
        clean_jupyter(**kwargs)
      File "/Users/hamel/github/nbdev/nbdev/clean.py", line 146, in clean_jupyter
        jupyter_hooks = get_config(path=path).get('jupyter_hooks')
      File "/Users/hamel/github/fastcore/fastcore/foundation.py", line 269, in __getattr__
        def __getattr__(self,k):   return stop(AttributeError(k)) if k=='d' or k not in self.d else self.get(k)
      File "/Users/hamel/github/fastcore/fastcore/basics.py", line 216, in stop
        raise e
    AttributeError: jupyter_hooks

On further investigation, it appears that cfg._apply_defaults is not applying a default because mysteriously cfg.get('jupyter_hooks') is returning False, even though I have no user level configs. What is even more mysterious is that

cfg.get('jupyter_hooks') returns False
but cfg.jupyter_hooks raises an AttributeError

I have no idea where the False is coming from either, but that is a separate issue.

This is a repo I created this morning and it failed on that

@hamelsmu hamelsmu added the bug Something isn't working label Sep 9, 2022
@hamelsmu hamelsmu requested a review from seeM September 9, 2022 18:41
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@hamelsmu hamelsmu closed this Sep 9, 2022
@jph00 jph00 deleted the hook-error branch January 31, 2023 01:01
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

Successfully merging this pull request may close these issues.

1 participant