-
Notifications
You must be signed in to change notification settings - Fork 58
Jupyter #206
-
I was successfully using Jupyter with Pyscript, but am now having a problem.
It used to be that
....In [1]: pyscript.list_global_ctx()
would give me a list of contexts, like
....Out [1] ['jupyter_3', 'jupyter_0', 'jupyter_1', 'scripts.test_script']
and then I could switch
....In [2] pyscript.set_global_ctx('scripts.test_script')
and run tests in my project's context.
Now, however, my project's context is missing, so all I get is
....Out [1] ['jupyter_3', 'jupyter_0', 'jupyter_1']
If I try to switch to the context in which I'm doing development, I get a NameError:
....Exception in <jupyter_13> line 1:
........pyscript.set_global_ctx('scripts.test_script')
.....................................^
....NameError: global context 'scripts.test_script' does not exist
I believe this problem arose after I modified config.yaml to include a Pyscript-specific yaml file:
....pyscript: !include pyscript/config.yaml
I couldn't get that to work (it just hung HA), so I deleted the pyscript/config.yaml, and reverted config.yaml back to the original state.
Any suggestions short of reinstalling Pyscript and Jupyter?
Beta Was this translation helpful? Give feedback.
All reactions
The root cause of the problem was a Python newbie misunderstanding; failure to distinguish between runtime errors and compile time errors.
After a runtime error in the 'scripts.test_script' context, there is still a 'scripts.test_script' global context which Jupyter can see and which will be listed by the 'pyscript.list_global_ctx()' command. However, a compile time error in the script will--of course--prevent the context from being created in the first place, which explains why it was not showing up.
Replies: 2 comments
-
This was temporarily resolved by reinstalling Anaconda, but the problem recurred after about a day.
Beta Was this translation helpful? Give feedback.
All reactions
-
The root cause of the problem was a Python newbie misunderstanding; failure to distinguish between runtime errors and compile time errors.
After a runtime error in the 'scripts.test_script' context, there is still a 'scripts.test_script' global context which Jupyter can see and which will be listed by the 'pyscript.list_global_ctx()' command. However, a compile time error in the script will--of course--prevent the context from being created in the first place, which explains why it was not showing up.
Beta Was this translation helpful? Give feedback.