Skip to content

Stop example execution as soon as one cell has an error #88

@lesteve

Description

@lesteve

In a large majority of cases, an error when executing one cell, is going to cause further cells to have errors. I think it just adds unnecessary noise:

This is the root cause of the problem:

  File "/home/ubuntu/nilearn/doc/sphinxext/sphinx_gallery/gen_rst.py", line 427, in execute_script
    exec(code_block, example_globals)
  File "<string>", line 3, in <module>
  File "/home/ubuntu/nilearn/nilearn/datasets/func.py", line 481, in fetch_adhd
    resume=resume, verbose=verbose)
  File "/home/ubuntu/nilearn/nilearn/datasets/utils.py", line 728, in _fetch_files
    raise IOError('Fetching aborted: ' + abort)
IOError: Fetching aborted: CRC check failed 0x55f58d0f != 0xd6aafce5L

And this is all the additional stuff you get from trying to execute cells after the first failure:

Traceback (most recent call last):
  File "/home/ubuntu/nilearn/doc/sphinxext/sphinx_gallery/gen_rst.py", line 427, in execute_script
    exec(code_block, example_globals)
  File "<string>", line 6, in <module>
NameError: name 'func_filenames' is not defined
Traceback (most recent call last):
  File "/home/ubuntu/nilearn/doc/sphinxext/sphinx_gallery/gen_rst.py", line 427, in execute_script
    exec(code_block, example_globals)
  File "<string>", line 4, in <module>
NameError: name 'components_img' is not defined
Traceback (most recent call last):
  File "/home/ubuntu/nilearn/doc/sphinxext/sphinx_gallery/gen_rst.py", line 427, in execute_script
    exec(code_block, example_globals)
  File "<string>", line 4, in <module>
NameError: name 'components_img' is not defined
Traceback (most recent call last):
  File "/home/ubuntu/nilearn/doc/sphinxext/sphinx_gallery/gen_rst.py", line 427, in execute_script
    exec(code_block, example_globals)
  File "<string>", line 3, in <module>
  File "/home/ubuntu/nilearn/nilearn/datasets/func.py", line 481, in fetch_adhd
    resume=resume, verbose=verbose)
  File "/home/ubuntu/nilearn/nilearn/datasets/utils.py", line 695, in _fetch_files
    overwrite=overwrite)
  File "/home/ubuntu/nilearn/nilearn/datasets/utils.py", line 523, in _fetch_file
    data = url_opener.open(request)
  File "/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1222, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 111] Connection refused| Error while fetching file adhd40_0010064.tgz; dataset fetching aborted.>
Traceback (most recent call last):
  File "/home/ubuntu/nilearn/doc/sphinxext/sphinx_gallery/gen_rst.py", line 427, in execute_script
    exec(code_block, example_globals)
  File "<string>", line 7, in <module>
NameError: name 'func_filenames' is not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions