Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jupyter in VS Code - Wait for websocket to connect #172

Open
smrfeld opened this issue Aug 30, 2021 · 4 comments
Open

Jupyter in VS Code - Wait for websocket to connect #172

smrfeld opened this issue Aug 30, 2021 · 4 comments

Comments

@smrfeld
Copy link

smrfeld commented Aug 30, 2021

Hi, I am running a notebook in VS code with the tutorial commands:

from vpython import *
sphere()

The first command finishes but the second hangs on this line from the stack trace:

KeyboardInterrupt
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-2-b919c6b7ad5b> in <module>
----> 1 sphere()

~/opt/anaconda3/lib/python3.7/site-packages/vpython/vpython.py in __init__(self, **args)
   1148         args['_default_size'] = vector(2,2,2)
   1149         args['_objName'] = "sphere"
-> 1150         super(sphere, self).setup(args)
   1151         self._sizing = False # no axis/size connection
   1152 

~/opt/anaconda3/lib/python3.7/site-packages/vpython/vpython.py in setup(self, args)
    582 
    583     def setup(self, args):
--> 584         super(standardAttributes, self).__init__()
    585         self._constructing = True  ## calls to setters are from constructor
    586 

~/opt/anaconda3/lib/python3.7/site-packages/vpython/vpython.py in __init__(self, **kwargs)
    236                 baseObj._canvas_constructing):
    237             if _isnotebook:
--> 238                 from .with_notebook import _
    239             else:
    240                 from .no_notebook import _

~/opt/anaconda3/lib/python3.7/site-packages/vpython/with_notebook.py in <module>
    151 baseObj.glow = GlowWidget(wsport=__SOCKET_PORT, wsuri='/ws')
    152 while (not wsConnected):
--> 153     time.sleep(0.1)          # wait for websocket to connect
    154 
    155 baseObj.trigger()  # start the trigger ping-pong process

KeyboardInterrupt: 
@BruceSherwood
Copy link
Member

What do you see if you simply execute print(version)? Can you run a simple Jupyter notebook program from a different launcher, outside of VSC?

@smrfeld
Copy link
Author

smrfeld commented Aug 30, 2021

The version output is:

['7.6.2', 'jupyter']

I also tried from jupyter-lab now with the same result

@BruceSherwood
Copy link
Member

How about jupyter notebook?

@jeb12301
Copy link

jeb12301 commented Feb 23, 2022

Hi, I am getting the exact same error running vpython in jupyterlab

Python 3.8.12
Jupyterlab 3.2.1-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants