notebook execution fails if there's anything in stdout #94
Open
Description
ploomber-core 0.2.17 introduced a change to print a Ploomber Cloud link at a regular interval. However, this breaks notebook execution.
We realized this because one of our automated notebooks started failing:
0%| | 0/90 [00:00<?, ?it/s]
Executing cell: 1: 0%| | 0/90 [00:00<?, ?it/s]
Executing cell: 1: 2%|▏ | 2/90 [00:00<00:16, 5.40it/s]
Executing cell: 2: 2%|▏ | 2/90 [00:00<00:16, 5.40it/s]
Executing cell: 2: 2%|▏ | 2/90 [00:01<00:46, 1.89it/s]
Deploy AI and data apps for free on Ploomber Cloud! Learn more: https://docs.cloud.ploomber.io/en/latest/quickstart/signup.html
An error happened while executing the notebook. Partially executed notebook stored at report.ipynb
Traceback (most recent call last):
File "/usr/share/miniconda3/bin/ploomber-engine", line 8, in <module>
sys.exit(cli())
^^^^^
File "/usr/share/miniconda3/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/miniconda3/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/share/miniconda3/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/miniconda3/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/miniconda3/lib/python3.11/site-packages/ploomber_engine/cli.py", line 106, in cli
execute_notebook(
File "/usr/share/miniconda3/lib/python3.11/site-packages/ploomber_core/telemetry/telemetry.py", line 679, in wrapper
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/miniconda3/lib/python3.11/site-packages/ploomber_engine/execute.py", line 179, in execute_notebook
out = client.execute(parameters=parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/miniconda3/lib/python3.11/site-packages/ploomber_engine/ipython.py", line 498, in execute
self._execute()
File "/usr/share/miniconda3/lib/python3.11/site-packages/ploomber_engine/ipython.py", line 621, in _execute
self.execute_cell(
File "/usr/share/miniconda3/lib/python3.11/site-packages/ploomber_engine/ipython.py", line 424, in execute_cell
output.extend(_process_stdout(stdout, result=result))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/miniconda3/lib/python3.11/site-packages/ploomber_engine/ipython.py", line 68, in _process_stdout
output_type="stream", text="".join(out), name="stdout"
^^^^^^^^^^^^
TypeError: sequence item 0: expected str instance, bytes found
Closing duckdb://
I replicated it by removing the last_cloud_check
from ~/.ploomber/stats/uid.yaml
and then tried to run a notebook. The fix should allow successful execution of notebooks even if there are prints to stdout
Metadata
Assignees
Labels
No labels