From 25ef93b31f818a5899027980732df831d1e1621a Mon Sep 17 00:00:00 2001 From: Craig Barratt <19445341+craigbarratt@users.noreply.github.com> Date: Wed, 14 Oct 2020 11:51:56 -0700 Subject: [PATCH] added __name__ to globals for jupyter sessions (set to global context name) --- custom_components/pyscript/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_components/pyscript/__init__.py b/custom_components/pyscript/__init__.py index 8474e73..45b0fe4 100644 --- a/custom_components/pyscript/__init__.py +++ b/custom_components/pyscript/__init__.py @@ -121,7 +121,9 @@ async def jupyter_kernel_start(call): _LOGGER.debug("service call to jupyter_kernel_start: %s", call.data) global_ctx_name = GlobalContextMgr.new_name("jupyter_") - global_ctx = GlobalContext(global_ctx_name, global_sym_table={}, manager=GlobalContextMgr) + global_ctx = GlobalContext( + global_ctx_name, global_sym_table={"__name__": global_ctx_name}, manager=GlobalContextMgr + ) global_ctx.set_auto_start(True) GlobalContextMgr.set(global_ctx_name, global_ctx)