nesting jupyter runs

Jupyter notebooks are a great way of sharing knowledge in science, art, programming. For instance, in a recent musing, I tried to programmatically determine the color of the sky. This renders as a web page, but is also a piece of runnable code.

As such, they are also great ways to store the knowledge that was acquired at a given time and that could be reusable. This may be considered as bad programming and may have downsides as described in that slides :

Joel Grus

Recently, thanks to an answer to a stack overflow question, I found a way to overcome this by detecting if the caall to a notebook is made from the notebook itself or from a parent.

It's as simple as this cell:

In [1]:
#verb =  (__name__ == "__main__")
def has_parent():
    """
    https://stackoverflow.com/questions/48067529/ipython-run-magic-n-switch-not-working
    
    Return True if this notebook is being run by calling
    %run in another notebook, False otherwise.
    """
    try:
        __file__
        # __file__ has been defined, so this notebook is 
        # being run in a parent notebook
        return True

    except NameError:
        # __file__ has not been defined, so this notebook is 
        # not being run in a parent notebook
        return False
def do_verb():
    return not has_parent()

verb = do_verb()
if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)
__name__= __main__ 
Am I a running this notebook directly?  True

Let's see what we have in the memory:

In [2]:
if verb:
    %whos
Variable     Type        Data/Info
----------------------------------
do_verb      function    <function do_verb at 0x111abe5e0>
has_parent   function    <function has_parent at 0x111abe670>
verb         bool        True

Let's run the above mentioned notebook by it from this URL:

In [3]:
if verb:
    %run -n 2020-07-04-colors-of-the-sky.ipynb
    verb = do_verb()

And now:

In [4]:
if verb:
    %whos
Variable         Type            Data/Info
------------------------------------------
CMF              ndarray         81x4: 324 elems, type `float64`, 2592 bytes
CMF_str          str             380 0.0014 0.0000 0.0065\<...>n780 0.0000 0.0000 0.0000
ColourSystem     type            <class '__main__.ColourSystem'>
bluesky          ndarray         3: 3 elems, type `float64`, 24 bytes
chappuis         function        <function chappuis at 0x12490f280>
cs_srgb          ColourSystem    <__main__.ColourSystem object at 0x1248e7970>
do_verb          function        <function do_verb at 0x111abe670>
fig_width        int             15
figsize          tuple           n=2
fontsize         int             20
has_parent       function        <function has_parent at 0x1164ee4c0>
i                int             80
illuminant_D65   ndarray         3: 3 elems, type `float64`, 24 bytes
intensity5800    ndarray         81: 81 elems, type `float64`, 648 bytes
line             str             780 0.0000 0.0000 0.0000
np               module          <module 'numpy' from '/us<...>kages/numpy/__init__.py'>
os               module          <module 'os' from '/usr/l<...>3.8/lib/python3.8/os.py'>
phi              float64         1.618033988749895
planck           function        <function planck at 0x1164ee310>
plt              module          <module 'matplotlib.pyplo<...>es/matplotlib/pyplot.py'>
rcParams         RcParams        _internal.classic_mode: F<...>: 0.6\nytick.right: False
scatter          ndarray         81: 81 elems, type `float64`, 648 bytes
scattering       function        <function scattering at 0x1248e1dc0>
spectrum         ndarray         81: 81 elems, type `float64`, 648 bytes
verb             bool            True
wavelengths      ndarray         81: 81 elems, type `float64`, 648 bytes
xyz_from_xy      function        <function xyz_from_xy at 0x1245498b0>

Meaning that I can access the functions and some data from this notebook, to be used in another one.

In [5]:
if verb:
    print('The color of the sky is equal to ', bluesky)
The color of the sky is equal to  [0.488779 0.672615 1.      ]

Note what you get if you call the notebook from the notebook, you get:

In [6]:
# see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
%run -n 2020-08-09-nesting-jupyter-runs.ipynb 
verb = do_verb()
if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    137     try:
--> 138         buf = fp.read()
    139     except AttributeError:

AttributeError: 'str' object has no attribute 'read'

During handling of the above exception, another exception occurred:

RecursionError                            Traceback (most recent call last)
~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2798         with prepended_to_syspath(dname):
   2799             try:
-> 2800                 for cell in get_cells():
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in get_cells()
   2786             if fname.endswith('.ipynb'):
   2787                 from nbformat import read
-> 2788                 nb = read(fname, as_version=4)
   2789                 if not nb.cells:
   2790                     return

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    139     except AttributeError:
    140         with io.open(fp, encoding='utf-8') as f:
--> 141             return reads(f.read(), as_version, **kwargs)
    142 
    143     return reads(buf, as_version, **kwargs)

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in reads(s, as_version, **kwargs)
     75         nb = convert(nb, as_version)
     76     try:
---> 77         validate(nb)
     78     except ValidationError as e:
     79         get_logger().error("Notebook JSON is invalid: %s", e)

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    272             version, version_minor = 1, 0
    273 
--> 274     for error in iter_validate(nbdict, ref=ref, version=version,
    275                                version_minor=version_minor,
    276                                relax_add_props=relax_add_props):

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in iter_validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    308         errors = validator.iter_errors(nbdict)
    309 
--> 310     for error in errors:
    311         yield better_validation_error(error, version, version_minor)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <listcomp>(.0)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_valid(self, instance, _schema)
    360 
    361         def is_valid(self, instance, _schema=None):
--> 362             error = next(self.iter_errors(instance, _schema), None)
    363             return error is None
    364 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in type(validator, types, instance, schema)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <genexpr>(.0)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_type(self, instance, type)
    355         def is_type(self, instance, type):
    356             try:
--> 357                 return self.TYPE_CHECKER.is_type(instance, type)
    358             except exceptions.UndefinedTypeCheck:
    359                 raise exceptions.UnknownType(type, instance, self.schema)

/usr/local/lib/python3.8/site-packages/jsonschema/_types.py in is_type(self, instance, type)
     89         """
     90         try:
---> 91             fn = self._type_checkers[type]
     92         except KeyError:
     93             raise UndefinedTypeCheck(type)

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in __getitem__(self, key)
     69 
     70     def __getitem__(self, key):
---> 71         return PMap._getitem(self._buckets, key)
     72 
     73     @staticmethod

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _getitem(buckets, key)
     60     @staticmethod
     61     def _getitem(buckets, key):
---> 62         _, bucket = PMap._get_bucket(buckets, key)
     63         if bucket:
     64             for k, v in bucket:

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _get_bucket(buckets, key)
     54     @staticmethod
     55     def _get_bucket(buckets, key):
---> 56         index = hash(key) % len(buckets)
     57         bucket = buckets[index]
     58         return index, bucket

RecursionError: maximum recursion depth exceeded while calling a Python object
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    137     try:
--> 138         buf = fp.read()
    139     except AttributeError:

AttributeError: 'str' object has no attribute 'read'

During handling of the above exception, another exception occurred:

RecursionError                            Traceback (most recent call last)
~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2798         with prepended_to_syspath(dname):
   2799             try:
-> 2800                 for cell in get_cells():
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in get_cells()
   2786             if fname.endswith('.ipynb'):
   2787                 from nbformat import read
-> 2788                 nb = read(fname, as_version=4)
   2789                 if not nb.cells:
   2790                     return

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    139     except AttributeError:
    140         with io.open(fp, encoding='utf-8') as f:
--> 141             return reads(f.read(), as_version, **kwargs)
    142 
    143     return reads(buf, as_version, **kwargs)

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in reads(s, as_version, **kwargs)
     75         nb = convert(nb, as_version)
     76     try:
---> 77         validate(nb)
     78     except ValidationError as e:
     79         get_logger().error("Notebook JSON is invalid: %s", e)

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    272             version, version_minor = 1, 0
    273 
--> 274     for error in iter_validate(nbdict, ref=ref, version=version,
    275                                version_minor=version_minor,
    276                                relax_add_props=relax_add_props):

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in iter_validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    308         errors = validator.iter_errors(nbdict)
    309 
--> 310     for error in errors:
    311         yield better_validation_error(error, version, version_minor)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <listcomp>(.0)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_valid(self, instance, _schema)
    360 
    361         def is_valid(self, instance, _schema=None):
--> 362             error = next(self.iter_errors(instance, _schema), None)
    363             return error is None
    364 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in type(validator, types, instance, schema)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <genexpr>(.0)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_type(self, instance, type)
    355         def is_type(self, instance, type):
    356             try:
--> 357                 return self.TYPE_CHECKER.is_type(instance, type)
    358             except exceptions.UndefinedTypeCheck:
    359                 raise exceptions.UnknownType(type, instance, self.schema)

/usr/local/lib/python3.8/site-packages/jsonschema/_types.py in is_type(self, instance, type)
     89         """
     90         try:
---> 91             fn = self._type_checkers[type]
     92         except KeyError:
     93             raise UndefinedTypeCheck(type)

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in __getitem__(self, key)
     69 
     70     def __getitem__(self, key):
---> 71         return PMap._getitem(self._buckets, key)
     72 
     73     @staticmethod

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _getitem(buckets, key)
     60     @staticmethod
     61     def _getitem(buckets, key):
---> 62         _, bucket = PMap._get_bucket(buckets, key)
     63         if bucket:
     64             for k, v in bucket:

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _get_bucket(buckets, key)
     54     @staticmethod
     55     def _get_bucket(buckets, key):
---> 56         index = hash(key) % len(buckets)
     57         bucket = buckets[index]
     58         return index, bucket

RecursionError: maximum recursion depth exceeded while calling a Python object
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    137     try:
--> 138         buf = fp.read()
    139     except AttributeError:

AttributeError: 'str' object has no attribute 'read'

During handling of the above exception, another exception occurred:

RecursionError                            Traceback (most recent call last)
~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2798         with prepended_to_syspath(dname):
   2799             try:
-> 2800                 for cell in get_cells():
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in get_cells()
   2786             if fname.endswith('.ipynb'):
   2787                 from nbformat import read
-> 2788                 nb = read(fname, as_version=4)
   2789                 if not nb.cells:
   2790                     return

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    139     except AttributeError:
    140         with io.open(fp, encoding='utf-8') as f:
--> 141             return reads(f.read(), as_version, **kwargs)
    142 
    143     return reads(buf, as_version, **kwargs)

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in reads(s, as_version, **kwargs)
     75         nb = convert(nb, as_version)
     76     try:
---> 77         validate(nb)
     78     except ValidationError as e:
     79         get_logger().error("Notebook JSON is invalid: %s", e)

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    272             version, version_minor = 1, 0
    273 
--> 274     for error in iter_validate(nbdict, ref=ref, version=version,
    275                                version_minor=version_minor,
    276                                relax_add_props=relax_add_props):

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in iter_validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    308         errors = validator.iter_errors(nbdict)
    309 
--> 310     for error in errors:
    311         yield better_validation_error(error, version, version_minor)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <listcomp>(.0)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_valid(self, instance, _schema)
    360 
    361         def is_valid(self, instance, _schema=None):
--> 362             error = next(self.iter_errors(instance, _schema), None)
    363             return error is None
    364 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in type(validator, types, instance, schema)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <genexpr>(.0)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_type(self, instance, type)
    355         def is_type(self, instance, type):
    356             try:
--> 357                 return self.TYPE_CHECKER.is_type(instance, type)
    358             except exceptions.UndefinedTypeCheck:
    359                 raise exceptions.UnknownType(type, instance, self.schema)

/usr/local/lib/python3.8/site-packages/jsonschema/_types.py in is_type(self, instance, type)
     89         """
     90         try:
---> 91             fn = self._type_checkers[type]
     92         except KeyError:
     93             raise UndefinedTypeCheck(type)

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in __getitem__(self, key)
     69 
     70     def __getitem__(self, key):
---> 71         return PMap._getitem(self._buckets, key)
     72 
     73     @staticmethod

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _getitem(buckets, key)
     60     @staticmethod
     61     def _getitem(buckets, key):
---> 62         _, bucket = PMap._get_bucket(buckets, key)
     63         if bucket:
     64             for k, v in bucket:

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _get_bucket(buckets, key)
     54     @staticmethod
     55     def _get_bucket(buckets, key):
---> 56         index = hash(key) % len(buckets)
     57         bucket = buckets[index]
     58         return index, bucket

RecursionError: maximum recursion depth exceeded while calling a Python object
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    137     try:
--> 138         buf = fp.read()
    139     except AttributeError:

AttributeError: 'str' object has no attribute 'read'

During handling of the above exception, another exception occurred:

RecursionError                            Traceback (most recent call last)
~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2798         with prepended_to_syspath(dname):
   2799             try:
-> 2800                 for cell in get_cells():
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in get_cells()
   2786             if fname.endswith('.ipynb'):
   2787                 from nbformat import read
-> 2788                 nb = read(fname, as_version=4)
   2789                 if not nb.cells:
   2790                     return

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    139     except AttributeError:
    140         with io.open(fp, encoding='utf-8') as f:
--> 141             return reads(f.read(), as_version, **kwargs)
    142 
    143     return reads(buf, as_version, **kwargs)

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in reads(s, as_version, **kwargs)
     75         nb = convert(nb, as_version)
     76     try:
---> 77         validate(nb)
     78     except ValidationError as e:
     79         get_logger().error("Notebook JSON is invalid: %s", e)

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    272             version, version_minor = 1, 0
    273 
--> 274     for error in iter_validate(nbdict, ref=ref, version=version,
    275                                version_minor=version_minor,
    276                                relax_add_props=relax_add_props):

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in iter_validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    308         errors = validator.iter_errors(nbdict)
    309 
--> 310     for error in errors:
    311         yield better_validation_error(error, version, version_minor)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <listcomp>(.0)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_valid(self, instance, _schema)
    360 
    361         def is_valid(self, instance, _schema=None):
--> 362             error = next(self.iter_errors(instance, _schema), None)
    363             return error is None
    364 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in type(validator, types, instance, schema)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <genexpr>(.0)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_type(self, instance, type)
    355         def is_type(self, instance, type):
    356             try:
--> 357                 return self.TYPE_CHECKER.is_type(instance, type)
    358             except exceptions.UndefinedTypeCheck:
    359                 raise exceptions.UnknownType(type, instance, self.schema)

/usr/local/lib/python3.8/site-packages/jsonschema/_types.py in is_type(self, instance, type)
     89         """
     90         try:
---> 91             fn = self._type_checkers[type]
     92         except KeyError:
     93             raise UndefinedTypeCheck(type)

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in __getitem__(self, key)
     69 
     70     def __getitem__(self, key):
---> 71         return PMap._getitem(self._buckets, key)
     72 
     73     @staticmethod

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _getitem(buckets, key)
     60     @staticmethod
     61     def _getitem(buckets, key):
---> 62         _, bucket = PMap._get_bucket(buckets, key)
     63         if bucket:
     64             for k, v in bucket:

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _get_bucket(buckets, key)
     54     @staticmethod
     55     def _get_bucket(buckets, key):
---> 56         index = hash(key) % len(buckets)
     57         bucket = buckets[index]
     58         return index, bucket

RecursionError: maximum recursion depth exceeded while calling a Python object
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    137     try:
--> 138         buf = fp.read()
    139     except AttributeError:

AttributeError: 'str' object has no attribute 'read'

During handling of the above exception, another exception occurred:

RecursionError                            Traceback (most recent call last)
~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2798         with prepended_to_syspath(dname):
   2799             try:
-> 2800                 for cell in get_cells():
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in get_cells()
   2786             if fname.endswith('.ipynb'):
   2787                 from nbformat import read
-> 2788                 nb = read(fname, as_version=4)
   2789                 if not nb.cells:
   2790                     return

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    139     except AttributeError:
    140         with io.open(fp, encoding='utf-8') as f:
--> 141             return reads(f.read(), as_version, **kwargs)
    142 
    143     return reads(buf, as_version, **kwargs)

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in reads(s, as_version, **kwargs)
     75         nb = convert(nb, as_version)
     76     try:
---> 77         validate(nb)
     78     except ValidationError as e:
     79         get_logger().error("Notebook JSON is invalid: %s", e)

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    272             version, version_minor = 1, 0
    273 
--> 274     for error in iter_validate(nbdict, ref=ref, version=version,
    275                                version_minor=version_minor,
    276                                relax_add_props=relax_add_props):

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in iter_validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    308         errors = validator.iter_errors(nbdict)
    309 
--> 310     for error in errors:
    311         yield better_validation_error(error, version, version_minor)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <listcomp>(.0)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_valid(self, instance, _schema)
    360 
    361         def is_valid(self, instance, _schema=None):
--> 362             error = next(self.iter_errors(instance, _schema), None)
    363             return error is None
    364 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in type(validator, types, instance, schema)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <genexpr>(.0)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_type(self, instance, type)
    355         def is_type(self, instance, type):
    356             try:
--> 357                 return self.TYPE_CHECKER.is_type(instance, type)
    358             except exceptions.UndefinedTypeCheck:
    359                 raise exceptions.UnknownType(type, instance, self.schema)

/usr/local/lib/python3.8/site-packages/jsonschema/_types.py in is_type(self, instance, type)
     89         """
     90         try:
---> 91             fn = self._type_checkers[type]
     92         except KeyError:
     93             raise UndefinedTypeCheck(type)

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in __getitem__(self, key)
     69 
     70     def __getitem__(self, key):
---> 71         return PMap._getitem(self._buckets, key)
     72 
     73     @staticmethod

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _getitem(buckets, key)
     60     @staticmethod
     61     def _getitem(buckets, key):
---> 62         _, bucket = PMap._get_bucket(buckets, key)
     63         if bucket:
     64             for k, v in bucket:

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _get_bucket(buckets, key)
     54     @staticmethod
     55     def _get_bucket(buckets, key):
---> 56         index = hash(key) % len(buckets)
     57         bucket = buckets[index]
     58         return index, bucket

RecursionError: maximum recursion depth exceeded while calling a Python object
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    137     try:
--> 138         buf = fp.read()
    139     except AttributeError:

AttributeError: 'str' object has no attribute 'read'

During handling of the above exception, another exception occurred:

RecursionError                            Traceback (most recent call last)
~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2798         with prepended_to_syspath(dname):
   2799             try:
-> 2800                 for cell in get_cells():
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in get_cells()
   2786             if fname.endswith('.ipynb'):
   2787                 from nbformat import read
-> 2788                 nb = read(fname, as_version=4)
   2789                 if not nb.cells:
   2790                     return

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    139     except AttributeError:
    140         with io.open(fp, encoding='utf-8') as f:
--> 141             return reads(f.read(), as_version, **kwargs)
    142 
    143     return reads(buf, as_version, **kwargs)

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in reads(s, as_version, **kwargs)
     75         nb = convert(nb, as_version)
     76     try:
---> 77         validate(nb)
     78     except ValidationError as e:
     79         get_logger().error("Notebook JSON is invalid: %s", e)

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    272             version, version_minor = 1, 0
    273 
--> 274     for error in iter_validate(nbdict, ref=ref, version=version,
    275                                version_minor=version_minor,
    276                                relax_add_props=relax_add_props):

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in iter_validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    308         errors = validator.iter_errors(nbdict)
    309 
--> 310     for error in errors:
    311         yield better_validation_error(error, version, version_minor)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <listcomp>(.0)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_valid(self, instance, _schema)
    360 
    361         def is_valid(self, instance, _schema=None):
--> 362             error = next(self.iter_errors(instance, _schema), None)
    363             return error is None
    364 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in type(validator, types, instance, schema)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <genexpr>(.0)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_type(self, instance, type)
    355         def is_type(self, instance, type):
    356             try:
--> 357                 return self.TYPE_CHECKER.is_type(instance, type)
    358             except exceptions.UndefinedTypeCheck:
    359                 raise exceptions.UnknownType(type, instance, self.schema)

/usr/local/lib/python3.8/site-packages/jsonschema/_types.py in is_type(self, instance, type)
     89         """
     90         try:
---> 91             fn = self._type_checkers[type]
     92         except KeyError:
     93             raise UndefinedTypeCheck(type)

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in __getitem__(self, key)
     69 
     70     def __getitem__(self, key):
---> 71         return PMap._getitem(self._buckets, key)
     72 
     73     @staticmethod

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _getitem(buckets, key)
     60     @staticmethod
     61     def _getitem(buckets, key):
---> 62         _, bucket = PMap._get_bucket(buckets, key)
     63         if bucket:
     64             for k, v in bucket:

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _get_bucket(buckets, key)
     54     @staticmethod
     55     def _get_bucket(buckets, key):
---> 56         index = hash(key) % len(buckets)
     57         bucket = buckets[index]
     58         return index, bucket

RecursionError: maximum recursion depth exceeded while calling a Python object
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    137     try:
--> 138         buf = fp.read()
    139     except AttributeError:

AttributeError: 'str' object has no attribute 'read'

During handling of the above exception, another exception occurred:

RecursionError                            Traceback (most recent call last)
~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2798         with prepended_to_syspath(dname):
   2799             try:
-> 2800                 for cell in get_cells():
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in get_cells()
   2786             if fname.endswith('.ipynb'):
   2787                 from nbformat import read
-> 2788                 nb = read(fname, as_version=4)
   2789                 if not nb.cells:
   2790                     return

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    139     except AttributeError:
    140         with io.open(fp, encoding='utf-8') as f:
--> 141             return reads(f.read(), as_version, **kwargs)
    142 
    143     return reads(buf, as_version, **kwargs)

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in reads(s, as_version, **kwargs)
     75         nb = convert(nb, as_version)
     76     try:
---> 77         validate(nb)
     78     except ValidationError as e:
     79         get_logger().error("Notebook JSON is invalid: %s", e)

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    272             version, version_minor = 1, 0
    273 
--> 274     for error in iter_validate(nbdict, ref=ref, version=version,
    275                                version_minor=version_minor,
    276                                relax_add_props=relax_add_props):

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in iter_validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    308         errors = validator.iter_errors(nbdict)
    309 
--> 310     for error in errors:
    311         yield better_validation_error(error, version, version_minor)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <listcomp>(.0)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_valid(self, instance, _schema)
    360 
    361         def is_valid(self, instance, _schema=None):
--> 362             error = next(self.iter_errors(instance, _schema), None)
    363             return error is None
    364 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in type(validator, types, instance, schema)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <genexpr>(.0)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_type(self, instance, type)
    355         def is_type(self, instance, type):
    356             try:
--> 357                 return self.TYPE_CHECKER.is_type(instance, type)
    358             except exceptions.UndefinedTypeCheck:
    359                 raise exceptions.UnknownType(type, instance, self.schema)

/usr/local/lib/python3.8/site-packages/jsonschema/_types.py in is_type(self, instance, type)
     89         """
     90         try:
---> 91             fn = self._type_checkers[type]
     92         except KeyError:
     93             raise UndefinedTypeCheck(type)

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in __getitem__(self, key)
     69 
     70     def __getitem__(self, key):
---> 71         return PMap._getitem(self._buckets, key)
     72 
     73     @staticmethod

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _getitem(buckets, key)
     60     @staticmethod
     61     def _getitem(buckets, key):
---> 62         _, bucket = PMap._get_bucket(buckets, key)
     63         if bucket:
     64             for k, v in bucket:

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _get_bucket(buckets, key)
     54     @staticmethod
     55     def _get_bucket(buckets, key):
---> 56         index = hash(key) % len(buckets)
     57         bucket = buckets[index]
     58         return index, bucket

RecursionError: maximum recursion depth exceeded while calling a Python object
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    137     try:
--> 138         buf = fp.read()
    139     except AttributeError:

AttributeError: 'str' object has no attribute 'read'

During handling of the above exception, another exception occurred:

RecursionError                            Traceback (most recent call last)
~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2798         with prepended_to_syspath(dname):
   2799             try:
-> 2800                 for cell in get_cells():
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in get_cells()
   2786             if fname.endswith('.ipynb'):
   2787                 from nbformat import read
-> 2788                 nb = read(fname, as_version=4)
   2789                 if not nb.cells:
   2790                     return

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    139     except AttributeError:
    140         with io.open(fp, encoding='utf-8') as f:
--> 141             return reads(f.read(), as_version, **kwargs)
    142 
    143     return reads(buf, as_version, **kwargs)

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in reads(s, as_version, **kwargs)
     75         nb = convert(nb, as_version)
     76     try:
---> 77         validate(nb)
     78     except ValidationError as e:
     79         get_logger().error("Notebook JSON is invalid: %s", e)

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    272             version, version_minor = 1, 0
    273 
--> 274     for error in iter_validate(nbdict, ref=ref, version=version,
    275                                version_minor=version_minor,
    276                                relax_add_props=relax_add_props):

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in iter_validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    308         errors = validator.iter_errors(nbdict)
    309 
--> 310     for error in errors:
    311         yield better_validation_error(error, version, version_minor)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <listcomp>(.0)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_valid(self, instance, _schema)
    360 
    361         def is_valid(self, instance, _schema=None):
--> 362             error = next(self.iter_errors(instance, _schema), None)
    363             return error is None
    364 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in type(validator, types, instance, schema)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <genexpr>(.0)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_type(self, instance, type)
    355         def is_type(self, instance, type):
    356             try:
--> 357                 return self.TYPE_CHECKER.is_type(instance, type)
    358             except exceptions.UndefinedTypeCheck:
    359                 raise exceptions.UnknownType(type, instance, self.schema)

/usr/local/lib/python3.8/site-packages/jsonschema/_types.py in is_type(self, instance, type)
     89         """
     90         try:
---> 91             fn = self._type_checkers[type]
     92         except KeyError:
     93             raise UndefinedTypeCheck(type)

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in __getitem__(self, key)
     69 
     70     def __getitem__(self, key):
---> 71         return PMap._getitem(self._buckets, key)
     72 
     73     @staticmethod

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _getitem(buckets, key)
     60     @staticmethod
     61     def _getitem(buckets, key):
---> 62         _, bucket = PMap._get_bucket(buckets, key)
     63         if bucket:
     64             for k, v in bucket:

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _get_bucket(buckets, key)
     54     @staticmethod
     55     def _get_bucket(buckets, key):
---> 56         index = hash(key) % len(buckets)
     57         bucket = buckets[index]
     58         return index, bucket

RecursionError: maximum recursion depth exceeded while calling a Python object
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    137     try:
--> 138         buf = fp.read()
    139     except AttributeError:

AttributeError: 'str' object has no attribute 'read'

During handling of the above exception, another exception occurred:

RecursionError                            Traceback (most recent call last)
~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:
-> 2803                         result.raise_error()
   2804                     elif not result.success:
   2805                         break

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in raise_error(self)
    329             raise self.error_before_exec
    330         if self.error_in_exec is not None:
--> 331             raise self.error_in_exec
    332 
    333     def __repr__(self):

    [... skipping hidden 1 frame]

~/quantic/blog/laurentperrinet.github.io_sciblog/posts/2020-08-09-nesting-jupyter-runs.ipynb in <module>
      1 # see https://laurentperrinet.github.io/sciblog/posts/2020-08-09-nesting-jupyter-runs.html
----> 2 get_ipython().run_line_magic('run', '-n 2020-08-09-nesting-jupyter-runs.ipynb ')
      3 verb = do_verb()
      4 if verb : print('__name__=', __name__, '\nAm I a running this notebook directly? ', verb)

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2324                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2325             with self.builtin_trap:
-> 2326                 result = fn(*args, **kwargs)
   2327             return result
   2328 

<decorator-gen-59> in run(self, parameter_s, runner, file_finder)

/usr/local/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.8/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
    716             with preserve_keys(self.shell.user_ns, '__file__'):
    717                 self.shell.user_ns['__file__'] = filename
--> 718                 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
    719             return
    720 

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
   2798         with prepended_to_syspath(dname):
   2799             try:
-> 2800                 for cell in get_cells():
   2801                     result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
   2802                     if raise_exceptions:

/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py in get_cells()
   2786             if fname.endswith('.ipynb'):
   2787                 from nbformat import read
-> 2788                 nb = read(fname, as_version=4)
   2789                 if not nb.cells:
   2790                     return

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in read(fp, as_version, **kwargs)
    139     except AttributeError:
    140         with io.open(fp, encoding='utf-8') as f:
--> 141             return reads(f.read(), as_version, **kwargs)
    142 
    143     return reads(buf, as_version, **kwargs)

/usr/local/lib/python3.8/site-packages/nbformat/__init__.py in reads(s, as_version, **kwargs)
     75         nb = convert(nb, as_version)
     76     try:
---> 77         validate(nb)
     78     except ValidationError as e:
     79         get_logger().error("Notebook JSON is invalid: %s", e)

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    272             version, version_minor = 1, 0
    273 
--> 274     for error in iter_validate(nbdict, ref=ref, version=version,
    275                                version_minor=version_minor,
    276                                relax_add_props=relax_add_props):

/usr/local/lib/python3.8/site-packages/nbformat/validator.py in iter_validate(nbdict, ref, version, version_minor, relax_add_props, nbjson)
    308         errors = validator.iter_errors(nbdict)
    309 
--> 310     for error in errors:
    311         yield better_validation_error(error, version, version_minor)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_legacy_validators.py in items_draft3_draft4(validator, items, instance, schema)
     53     if validator.is_type(items, "object"):
     54         for index, item in enumerate(instance):
---> 55             for error in validator.descend(item, items, path=index):
     56                 yield error
     57     else:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    335     all_errors = []
    336     for index, subschema in subschemas:
--> 337         errs = list(validator.descend(instance, subschema, schema_path=index))
    338         if not errs:
    339             first_valid = subschema

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in properties(validator, properties, instance, schema)
    280     for property, subschema in iteritems(properties):
    281         if property in instance:
--> 282             for error in validator.descend(
    283                 instance[property],
    284                 subschema,

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in ref(validator, ref, instance, schema)
    261 
    262         try:
--> 263             for error in validator.descend(instance, resolved):
    264                 yield error
    265         finally:

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in descend(self, instance, schema, path, schema_path)
    342 
    343         def descend(self, instance, schema, path=None, schema_path=None):
--> 344             for error in self.iter_errors(instance, schema):
    345                 if path is not None:
    346                     error.path.appendleft(path)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in oneOf(validator, oneOf, instance, schema)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <listcomp>(.0)
    346         )
    347 
--> 348     more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
    349     if more_valid:
    350         more_valid.append(first_valid)

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_valid(self, instance, _schema)
    360 
    361         def is_valid(self, instance, _schema=None):
--> 362             error = next(self.iter_errors(instance, _schema), None)
    363             return error is None
    364 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in iter_errors(self, instance, _schema)
    326 
    327                     errors = validator(self, v, instance, _schema) or ()
--> 328                     for error in errors:
    329                         # set details if not already set by the called fn
    330                         error._set(

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in type(validator, types, instance, schema)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/_validators.py in <genexpr>(.0)
    270     types = ensure_list(types)
    271 
--> 272     if not any(validator.is_type(instance, type) for type in types):
    273         yield ValidationError(types_msg(instance, types))
    274 

/usr/local/lib/python3.8/site-packages/jsonschema/validators.py in is_type(self, instance, type)
    355         def is_type(self, instance, type):
    356             try:
--> 357                 return self.TYPE_CHECKER.is_type(instance, type)
    358             except exceptions.UndefinedTypeCheck:
    359                 raise exceptions.UnknownType(type, instance, self.schema)

/usr/local/lib/python3.8/site-packages/jsonschema/_types.py in is_type(self, instance, type)
     89         """
     90         try:
---> 91             fn = self._type_checkers[type]
     92         except KeyError:
     93             raise UndefinedTypeCheck(type)

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in __getitem__(self, key)
     69 
     70     def __getitem__(self, key):
---> 71         return PMap._getitem(self._buckets, key)
     72 
     73     @staticmethod

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _getitem(buckets, key)
     60     @staticmethod
     61     def _getitem(buckets, key):
---> 62         _, bucket = PMap._get_bucket(buckets, key)
     63         if bucket:
     64             for k, v in bucket:

/usr/local/lib/python3.8/site-packages/pyrsistent/_pmap.py in _get_bucket(buckets, key)
     54     @staticmethod
     55     def _get_bucket(buckets, key)