Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: can only join an iterable #141

Closed
certik opened this issue Apr 7, 2021 · 0 comments · Fixed by #142
Closed

TypeError: can only join an iterable #141

certik opened this issue Apr 7, 2021 · 0 comments · Fixed by #142

Comments

@certik
Copy link
Contributor

certik commented Apr 7, 2021

We got this curious error message at our CI:

https://gitlab.com/certik/lfortran/-/jobs/1158527677#L460

I could reproduce it locally also:

(xeuslf) lfortran/lfortran(ast1) $ jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --output Demo1_out.ipynb share/lfortran/nb/Demo1.ipynb
[NbConvertApp] Converting notebook share/lfortran/nb/Demo1.ipynb to notebook
Run with XEUS 1.0.1
[NbConvertApp] Executing notebook with kernel: fortran
None
Traceback (most recent call last):
  File "/Users/certik/miniforge3/envs/xeuslf/bin/jupyter-nbconvert", line 11, in <module>
    sys.exit(main())
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/jupyter_core/application.py", line 254, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/traitlets/config/application.py", line 845, in launch_instance
    app.start()
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 350, in start
    self.convert_notebooks()
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 524, in convert_notebooks
    self.convert_single_notebook(notebook_filename)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 489, in convert_single_notebook
    output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 418, in export_single_notebook
    output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 181, in from_filename
    return self.from_file(f, resources=resources, **kw)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 199, in from_file
    return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbconvert/exporters/notebook.py", line 32, in from_notebook_node
    nb_copy, resources = super().from_notebook_node(nb, resources, **kw)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 143, in from_notebook_node
    nb_copy, resources = self._preprocess(nb_copy, resources)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 318, in _preprocess
    nbc, resc = preprocessor(nbc, resc)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbconvert/preprocessors/base.py", line 47, in __call__
    return self.preprocess(nb, resources)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbconvert/preprocessors/execute.py", line 79, in preprocess
    self.execute()
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbclient/util.py", line 74, in wrapped
    return just_run(coro(*args, **kwargs))
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbclient/util.py", line 53, in just_run
    return loop.run_until_complete(coro)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbclient/client.py", line 553, in async_execute
    await self.async_execute_cell(
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbconvert/preprocessors/execute.py", line 123, in async_execute_cell
    cell, resources = self.preprocess_cell(cell, self.resources, cell_index)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbconvert/preprocessors/execute.py", line 146, in preprocess_cell
    cell = run_sync(NotebookClient.async_execute_cell)(self, cell, index, store_history=self.store_history)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbclient/util.py", line 74, in wrapped
    return just_run(coro(*args, **kwargs))
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbclient/util.py", line 53, in just_run
    return loop.run_until_complete(coro)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nest_asyncio.py", line 70, in run_until_complete
    return f.result()
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/asyncio/futures.py", line 201, in result
    raise self._exception
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/asyncio/tasks.py", line 256, in __step
    result = coro.send(None)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbclient/client.py", line 857, in async_execute_cell
    self._check_raise_for_error(cell, exec_reply)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbclient/client.py", line 760, in _check_raise_for_error
    raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
  File "/Users/certik/miniforge3/envs/xeuslf/lib/python3.9/site-packages/nbclient/exceptions.py", line 92, in from_cell_and_msg
    tb = '\n'.join(msg.get('traceback', []))
TypeError: can only join an iterable

and I have a fix coming.

certik added a commit to certik/nbclient that referenced this issue Apr 7, 2021
Sometimes apparently the 'traceback' can be None, which results in throwing a `TypeError` exception. 

With this fix the actual underlying error will get printed, so that users can fix it.

Fixes jupyter#141.
davidbrochart added a commit that referenced this issue Apr 7, 2021
* Print useful error message on exception

Sometimes apparently the 'traceback' can be None, which results in throwing a `TypeError` exception. 

With this fix the actual underlying error will get printed, so that users can fix it.

Fixes #141.

* Update nbclient/exceptions.py

Co-authored-by: David Brochart <david.brochart@gmail.com>

Co-authored-by: David Brochart <david.brochart@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant