You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to be able to register events on colab like in Jupyter, and then access the runned cell content using: IPython.get_ipython().events.register('post_run_cell', function)
In Jupyter, post_run_cell is called with an argument (an ExecutionResult object) as you can see here, so its signature is post_run_cell(ExecutionResult result).
But in colab, there is no argument given to post_run_cell. Should it be considered a bug ?
I tried a workaround using the last_execution_result variable (also an ExecutionResult object), with IPython.get_ipython().last_execution_result but once again its seems to work in Jupyter only and I didn't find any equivalent. Is there any ?
In Jupyter, any of these two gives me an ExecutionResult object, from which I can get the cell raw input: result.info.raw_cell.
I finally found a workaround that would work only in colab :
Colab's IPython is currently on version 5.5 (version 6.0 dropped Python 3 support, and Colab still supports Python 2 kernels). If you're interested in using IPython events in IPython version 5.X, you can follow the documentation at https://ipython.readthedocs.io/en/5.x/config/callbacks.html.
I would like to be able to register events on colab like in Jupyter, and then access the runned cell content using:
IPython.get_ipython().events.register('post_run_cell', function)
In Jupyter,
post_run_cell
is called with an argument (anExecutionResult
object) as you can see here, so its signature ispost_run_cell(ExecutionResult result)
.But in colab, there is no argument given to
post_run_cell
. Should it be considered a bug ?I tried a workaround using the
last_execution_result
variable (also anExecutionResult
object), withIPython.get_ipython().last_execution_result
but once again its seems to work in Jupyter only and I didn't find any equivalent. Is there any ?In Jupyter, any of these two gives me an
ExecutionResult
object, from which I can get the cell raw input:result.info.raw_cell
.I finally found a workaround that would work only in colab :
My questions : Are all these differences normal ? Is there a "cross-platform" way to do it ?
The text was updated successfully, but these errors were encountered: