Skip to content

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

Open
@smrfeld

Description

@smrfeld

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: 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions