You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Project Jupyter
From python code in an ipython notebook cell is it possible to detect how the cell was executed. For instance is the cell being executed from a "shift enter" command or from a "run all cells" command.
Thanks
John
Matthias Bussonnier
unread,
Nov 24, 2017, 4:43:10 PM11/24/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jup...@googlegroups.com
Hi John,
No, you cannot detect that. The kernel is not even aware of whether it
is ran from a notebook or any other interface that may not have cells.
Maybe if you shared what you are trying to achieve we can find another solution.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Project Jupyter
I have a python cell that runs a long duration simulation and moves objects on a canvas on the front end. I would like to receive and process messages from the front end over a Comm channel while the python code is executing in a cell. Such as a mouse event when a user clicks on the canvas element and a message is sent over Comm to the python side. Is there a mechanism in ipython/notebook that will allow me to process a message from the front end while my python code is executing in a cell such as in a while loop that runs forever.
Thanks
John
Jason Grout
unread,
Nov 30, 2017, 7:51:51 PM11/30/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jup...@googlegroups.com
You can run your long-running code in a separate thread, so that your kernel will be able to respond to comm messages. If your long-running code is running in the main thread, that will block the message processing and your comm messages won't be processed.