Vypython: AttributeError: 'box' object has no attribute 'idx'

1,490 views
Skip to first unread message

Rémi Serra

unread,
Oct 20, 2020, 12:25:39 PM10/20/20
to VPython-users

Hello,

I am new to vpython and trying to learn. However, right after installing the module with "pip install vpython" on python 3.8 and making a python file that contains this :

from vpython import *

box()


I am greeted with an error:

Traceback (most recent call last):

  File "C:/Users/remis/PycharmProjects/VPython Test/Test Vpython.py", line 2, in <module>

    box()

  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\vpython.py", line 1099, in __init__

    super(box, self).setup(args)

  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\vpython.py", line 579, in setup

    super(standardAttributes, self).__init__()

  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\vpython.py", line 236, in __init__

    from .no_notebook import _

  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\no_notebook.py", line 271, in <module>

    __w = threading.Thread(target=__server.serve_forever)

NameError: name '__server' is not defined

Exception ignored in: <function standardAttributes.__del__ at 0x0000025590CEBB80>

Traceback (most recent call last):

  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\vpython.py", line 1092, in __del__

    super(standardAttributes, self).__del__()

  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\vpython.py", line 317, in __del__

    cmd = {"cmd": "delete", "idx": self.idx}

AttributeError: 'box' object has no attribute 'idx'


I didn't find any help online, so maybe I am making an obvious mistake. Can someone help me with this? Thanks in advance.

Lee Harrell

unread,
Oct 20, 2020, 1:52:42 PM10/20/20
to vpytho...@googlegroups.com
I just ran your 2 lines of code and it works fine. 

I’m using Anaconda via Spyder with Python 3.7 and used conda  to install vpython. 

--


You received this message because you are subscribed to the Google Groups "VPython-users" group.


To unsubscribe from this group and stop receiving emails from it, send an email to vpython-user...@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/vpython-users/a11af16a-0ad8-440a-9ebb-2f64383ff718n%40googlegroups.com.


--
Lee Harrell

Rémi Serra

unread,
Oct 20, 2020, 2:06:29 PM10/20/20
to vpytho...@googlegroups.com
This is what I feared... Is anaconda required to use vpython? Isn't it possible to run it only on python ?

You received this message because you are subscribed to a topic in the Google Groups "VPython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vpython-users/i-ZvjSoSbqk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vpython-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vpython-users/CAPM0%3DQ0nnnVx5F_%3DLhySisxmJxaFa7abSVwWQhYEhjc41zt_tQ%40mail.gmail.com.

John

unread,
Oct 20, 2020, 4:05:19 PM10/20/20
to VPython-users
No you do not need Anaconda to use vpython. Check that the vpython package can be accessed from your environment with the command

   where vpython

or 

   which vpython

You can also try

   pip show vpython

to verify that vpython is installed in your environmennt.

Another thing you can try is to set up a virtual environment and install vpython in that environment, then try running vpython in that environment after you install any other python packages you are using.


John



On Tuesday, October 20, 2020 at 11:06:29 AM UTC-7, Rémi Serra wrote:o 
This is what I feared... Is anaconda required to use vpython? Isn't it possible to run it only on python ?

To unsubscribe from this group and stop receiving emails from it, send an email to vpytho...@googlegroups.com.
--
Lee Harrell

--
You received this message because you are subscribed to a topic in the Google Groups "VPython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vpython-users/i-ZvjSoSbqk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vpytho...@googlegroups.com.

Rémi Serra

unread,
Oct 20, 2020, 4:40:18 PM10/20/20
to vpytho...@googlegroups.com
Thanks for your answer.

"Where vpython" doesn't find anything and "which vpython" isn't recognised as a command by my windows command prompt. However "pip show vpython" works and tells me the package version : 7.6.1.
In addition, the fact that no error occurs when importing vpython shows that the package is installed and usable by the environment.

I tried making a virtual environment and installing only vpython on it, and the same error pops up.

Any other ideas please?

To unsubscribe from this group and all its topics, send an email to vpython-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vpython-users/797a946f-f3f1-4462-80b1-af0ba59d0c74o%40googlegroups.com.

Bruce Sherwood

unread,
Oct 20, 2020, 5:31:57 PM10/20/20
to VPython-users
How do you launch your program? Your error trace shows a failure in setting up a browser in no_notebook.py (in which to present the 3D display, using the WebGL 3D graphics library built into browsers). The module no_notebook.,py imports lots of modules and, although one would expect the error trace to pick up a failure to import something, it might be useful to check whether these non-vpython modules are installed:

from http.server import BaseHTTPRequestHandler, HTTPServer
import os
import platform
import sys
import threading
import json
import webbrowser as _webbrowser
import asyncio
from autobahn.asyncio.websocket import WebSocketServerProtocol, WebSocketServerFactory
import txaio
import copy
import socket
import multiprocessing

import signal
from urllib.parse import unquote

Bruce

John

unread,
Oct 20, 2020, 8:10:05 PM10/20/20
to VPython-users
Try the command 

where python

and see if you have more than one version of python installed on your computer. 

Also check that you haven't created a file called vpython.py that is in your directory. Someone reported a similar problem to yours a while ago and it turned out they had created their own vpython.py file and the contents of that file was being imported instead of the vpython package.

John
To unsubscribe from this group and all its topics, send an email to vpytho...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vpython-users/797a946f-f3f1-4462-80b1-af0ba59d0c74o%40googlegroups.com.

Rémi Serra

unread,
Oct 21, 2020, 3:03:06 AM10/21/20
to vpytho...@googlegroups.com
Hello, thank you for your answers.
Importing all the modules suggested by Bruce didn't have any effect. I am using PyCharm to launch my program, but it shouldn't have any effect on it because I tried launching it from the windows power shell and the same error happened.
"where python" shows I only have one version of python installed. My python file is called "VPythonTest" and is alone in a folder that has the same name. No wrong imports should be possible.
I really don't understand why this happens. It makes it completely impossible for me to use vpython because it happens whenever I create a 3D object. I really need more help please.

To unsubscribe from this group and all its topics, send an email to vpython-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vpython-users/473d080f-f8a0-4cc1-ab3b-af131edfcacdo%40googlegroups.com.

Steve Spicklemire

unread,
Oct 21, 2020, 4:03:45 AM10/21/20
to vpytho...@googlegroups.com, Steve Spicklemire
I’m guessing that this error:

 File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\no_notebook.py", line 271, in <module>

    __w = threading.Thread(target=__server.serve_forever)

NameError: name '__server' is not defined

Is due to this bit failing: C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\no_notebook.py


It would be interesting to replace ‘pass’ with ‘raise’ on line 240 and see what error appears.

See the file here: 

C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\no_notebook.py

Line 240. Change “pass” to “raise”.

Thanks,
-Steve


To unsubscribe from this group and stop receiving emails from it, send an email to vpython-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vpython-users/CABq9r7Dcrjd0NRBteZzBqkevaCjnzT7DbLaf5HfeCMx3y0OmDA%40mail.gmail.com.

Rémi Serra

unread,
Oct 21, 2020, 4:31:14 AM10/21/20
to vpytho...@googlegroups.com
After replacing pass with raise, I get this error (hope it helps somehow):
Traceback (most recent call last):
  File "C:/Users/remis/PycharmProjects/VpythonTest/VPythonTest.py", line 2, in <module>
    box()
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\vpython.py", line 1099, in __init__
    super(box, self).setup(args)
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\vpython.py", line 579, in setup
    super(standardAttributes, self).__init__()
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\vpython.py", line 236, in __init__
    from .no_notebook import _
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\no_notebook.py", line 234, in <module>
    __server = HTTPServer(('', __HTTP_PORT), serveHTTP)
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 452, in __init__
    self.server_bind()
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\http\server.py", line 140, in server_bind
    self.server_name = socket.getfqdn(host)
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\socket.py", line 756, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 4: invalid continuation byte
Exception ignored in: <function standardAttributes.__del__ at 0x000001960D73EC10>
Traceback (most recent call last):
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\vpython.py", line 1092, in __del__
    super(standardAttributes, self).__del__()
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\vpython.py", line 317, in __del__
    cmd = {"cmd": "delete", "idx": self.idx}
AttributeError: 'box' object has no attribute 'idx'

Steve Spicklemire

unread,
Oct 21, 2020, 4:33:23 AM10/21/20
to vpytho...@googlegroups.com, Steve Spicklemire
What is your computer’s hostname? (Type hostname on the command line)
> <Screen Shot 2020-10-21 at 4.00.25 AM.png>
> To view this discussion on the web visit https://groups.google.com/d/msgid/vpython-users/CABq9r7CiOyKi10UGKq21uPiWsSN8qRekmJsQ_3kYNTEQ9a8mpA%40mail.gmail.com.

Rémi Serra

unread,
Oct 21, 2020, 4:42:47 AM10/21/20
to vpytho...@googlegroups.com
My pc's hostname is : PC-Rémi

Steve Spicklemire

unread,
Oct 21, 2020, 4:48:32 AM10/21/20
to vpytho...@googlegroups.com, Steve Spicklemire
I would change it to a completely vanilla name, no accents, or anything fancy, and see if that helps.
> To view this discussion on the web visit https://groups.google.com/d/msgid/vpython-users/CABq9r7AeB91DowTbZSg7SGe70fTmLvY7x8fyku0k6uX_-L2vug%40mail.gmail.com.

Rémi Serra

unread,
Oct 21, 2020, 5:17:55 AM10/21/20
to vpytho...@googlegroups.com
Thanks it now seems to work! However I did get and error message that didn't close the program:
Exception happened during processing of request from ('127.0.0.1', 50375)
Traceback (most recent call last):
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 316, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 347, in process_request
    self.finish_request(request, client_address)
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 720, in __init__
    self.handle()
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\http\server.py", line 427, in handle
    self.handle_one_request()
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\http\server.py", line 415, in handle_one_request
    method()
  File "C:\Users\remis\AppData\Local\Programs\Python\Python38\lib\site-packages\vpython\no_notebook.py", line 124, in do_GET
    fd = open(loc, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\remis\\AppData\\Local\\Programs\\Python\\Python38\\lib\\site-packages\\vpython\\vpython_libraries\\redmond/IDE/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png'
----------------------------------------

Bruce Sherwood

unread,
Oct 21, 2020, 12:25:55 PM10/21/20
to VPython-users
Inspect the contents of that directory, .....IDE/images. It should contain the following files, including the file that gave the error:


Those files can be found here: 


Bruce

Bruce Sherwood

unread,
Oct 21, 2020, 12:27:53 PM10/21/20
to VPython-users
The forum machinery deleted my image of the contents of that directory (?!), but you can see them at the URL I gave.

Bruce

Bruce Sherwood

unread,
Oct 21, 2020, 12:31:51 PM10/21/20
to VPython-users
Another attempt to display the contents of that directory:

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         6/12/2020   7:40 PM           1738 animated-overlay.gif
-a----         6/12/2020   7:40 PM            212 ui-bg_flat_0_aaaaaa_40x100.png
-a----         6/12/2020   7:40 PM            206 ui-bg_flat_55_fbec88_40x100.png
-a----         6/12/2020   7:40 PM            336 ui-bg_glass_75_d0e5f5_1x400.png
-a----         6/12/2020   7:40 PM            341 ui-bg_glass_85_dfeffc_1x400.png
-a----         6/12/2020   7:40 PM            332 ui-bg_glass_95_fef1ec_1x400.png
-a----         6/12/2020   7:40 PM           5824 ui-bg_gloss-wave_55_5c9ccc_500x100.png
-a----         6/12/2020   7:40 PM            333 ui-bg_inset-hard_100_f5f8f9_1x100.png
-a----         6/12/2020   7:40 PM            292 ui-bg_inset-hard_100_fcfdfd_1x100.png
-a----         6/12/2020   7:40 PM           4549 ui-icons_217bc0_256x240.png
-a----         6/12/2020   7:40 PM           4549 ui-icons_2e83ff_256x240.png
-a----         6/12/2020   7:40 PM           4549 ui-icons_469bdd_256x240.png
-a----         6/12/2020   7:40 PM           4549 ui-icons_6da8d5_256x240.png
-a----         6/12/2020   7:40 PM           4549 ui-icons_cd0a0a_256x240.png
-a----         6/12/2020   7:40 PM           4549 ui-icons_d8e7f3_256x240.png
-a----         6/12/2020   7:40 PM           4549 ui-icons_f9bd01_256x240.png

Bruce

高大庆

unread,
Feb 19, 2021, 2:17:33 AM2/19/21
to VPython-users
I met the same problem!
AttributeError: 'box' object has no attribute 'idx'

Do you know how to solve it?Thanks.

高大庆

unread,
Mar 31, 2021, 9:03:35 AM3/31/21
to VPython-users
Could anyone help me?I had already restalled anaconda,but it still had no use.
It drives me crazy。。。。crying...

Bruce Sherwood

unread,
Mar 31, 2021, 2:46:11 PM3/31/21
to VPython-users
Perhaps you have the same problem that the other person had? 

As was asked before: What is your computer’s hostname? (Type hostname on the command line.)

Bruce

Ping JIA

unread,
Apr 6, 2021, 1:39:04 AM4/6/21
to vpytho...@googlegroups.com
using virtualvenv repo. vpython works.
I think the reason this problem happens is a version mismatch.
(I use bigOS bigsur.)

yours.


Bruce Sherwood <bruce.s...@gmail.com> 于2021年4月1日周四 上午2:46写道:
Perhaps you have the same problem that the other person had? 

As was asked before: What is your computer’s hostname? (Type hostname on the command line.)

Bruce

--
You received this message because you are subscribed to the Google Groups "VPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vpython-user...@googlegroups.com.

Lehong Wang

unread,
May 12, 2022, 12:08:20 PM5/12/22
to VPython-users
Hi,

I'm also very new to vpython, and I also got the  AttributeError: 'box' object has no attribute 'idx'  error.
Here is my error message.

Traceback (most recent call last):
  File "/Users/lhwang/Documents/VScode Python/testVpython/testSphere.py", line 3, in <module>
    vpython.box()
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/vpython/vpython.py", line 1147, in __init__
    super(box, self).setup(args)
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/vpython/vpython.py", line 580, in setup
    super(standardAttributes, self).__init__()
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/vpython/vpython.py", line 241, in __init__
    from .no_notebook import _
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/vpython/no_notebook.py", line 12, in <module>

    from autobahn.asyncio.websocket import WebSocketServerProtocol, WebSocketServerFactory
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/autobahn/asyncio/__init__.py", line 32, in <module>
    from autobahn.asyncio.websocket import \
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/autobahn/asyncio/websocket.py", line 36, in <module>
    from autobahn.wamp import websocket
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/autobahn/wamp/websocket.py", line 32, in <module>
    from autobahn.websocket import protocol
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/autobahn/websocket/protocol.py", line 2533, in <module>
    class WebSocketServerProtocol(WebSocketProtocol):
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/autobahn/websocket/protocol.py", line 2538, in WebSocketServerProtocol
    log = txaio.make_logger()
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/txaio/_unframework.py", line 41, in _throw_usage_error
    raise RuntimeError(
RuntimeError: To use txaio, you must first select a framework with .use_twisted() or .use_asyncio()
Exception ignored in: <function standardAttributes.__del__ at 0x1077744c0>

Traceback (most recent call last):
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/vpython/vpython.py", line 1140, in __del__
    super(standardAttributes, self).__del__()
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/vpython/vpython.py", line 322, in __del__

    cmd = {"cmd": "delete", "idx": self.idx}
AttributeError: 'box' object has no attribute 'idx'


I'm running the program on Mac BigSur with VScode.
I tried the imports that Bruce suggested, and it give an error:

Traceback (most recent call last):
  File "/Users/lhwang/Documents/VScode Python/testVpython/testSphere.py", line 22, in <module>

    from autobahn.asyncio.websocket import WebSocketServerProtocol, WebSocketServerFactory
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/autobahn/asyncio/__init__.py", line 32, in <module>
    from autobahn.asyncio.websocket import \
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/autobahn/asyncio/websocket.py", line 36, in <module>
    from autobahn.wamp import websocket
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/autobahn/wamp/websocket.py", line 32, in <module>
    from autobahn.websocket import protocol
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/autobahn/websocket/protocol.py", line 2533, in <module>
    class WebSocketServerProtocol(WebSocketProtocol):
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/autobahn/websocket/protocol.py", line 2538, in WebSocketServerProtocol
    log = txaio.make_logger()
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/txaio/_unframework.py", line 41, in _throw_usage_error
    raise RuntimeError(
RuntimeError: To use txaio, you must first select a framework with .use_twisted() or .use_asyncio() 


My host name is very simple:    MacBookPro75.local
I also tried changing the pass to raise in no_notebook.py file, and it  doesn't work.

Could someone please help me with this? 

Thanks,
Lehong

Lehong Wang

unread,
May 12, 2022, 12:54:55 PM5/12/22
to VPython-users




I also tried running the code with Spyder:

import vpython
vpython.box()
while True:
  pass

and it give me the following error:


runfile('/Users/lhwang/Desktop/untitled0.py', wdir='/Users/lhwang/Desktop')
Exception ignored in: <function standardAttributes.__del__ at 0x114a33370>

Traceback (most recent call last):
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/vpython/vpython.py", line 1140, in __del__
    super(standardAttributes, self).__del__()
  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/vpython/vpython.py", line 322, in __del__
    cmd = {"cmd": "delete", "idx": self.idx}
AttributeError: 'box' object has no attribute 'idx'
Traceback (most recent call last):

  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/spyder_kernels/py3compat.py", line 356, in compat_exec
    exec(code, globals, locals)

  File "/Users/lhwang/Desktop/untitled0.py", line 12, in <module>

    vpython.box()

  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/vpython/vpython.py", line 1147, in __init__
    super(box, self).setup(args)

  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/vpython/vpython.py", line 580, in setup
    super(standardAttributes, self).__init__()

  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/vpython/vpython.py", line 241, in __init__
    from .no_notebook import _

  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/vpython/no_notebook.py", line 12, in <module>
    from autobahn.asyncio.websocket import WebSocketServerProtocol, WebSocketServerFactory

  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/autobahn/asyncio/__init__.py", line 32, in <module>
    from autobahn.asyncio.websocket import \

  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/autobahn/asyncio/websocket.py", line 36, in <module>
    from autobahn.wamp import websocket

  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/autobahn/wamp/websocket.py", line 32, in <module>
    from autobahn.websocket import protocol

  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/autobahn/websocket/protocol.py", line 2533, in <module>
    class WebSocketServerProtocol(WebSocketProtocol):

  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/autobahn/websocket/protocol.py", line 2538, in WebSocketServerProtocol
    log = txaio.make_logger()

  File "/Users/lhwang/.pyenv/versions/3.10.4/lib/python3.10/site-packages/txaio/_unframework.py", line 41, in _throw_usage_error
    raise RuntimeError(

RuntimeError: To use txaio, you must first select a framework with .use_twisted() or .use_asyncio()


Can someone help me with this?  crying 

Thanks,
Lehong


John

unread,
May 12, 2022, 3:00:29 PM5/12/22
to VPython-users
I am seeing the same problem when running vpython in no_notebook mode. However when I run vpython in a jupyter notebook it works fine. You can try running your vpython program in a jupyter notebook to see if that works for you. You can launch jupyter notebook from the terminal window with the command 

     jupyter notebook

then create a new notebook and type your vpython code in a notebook cell and execute it.

There appears to be a problem with vpython in no_notebook mode. I created a new python environment and just installed vpython and scipy in this environment and noticed that vpython no_notebook mode produced the error you reported.

John

John

unread,
May 12, 2022, 3:38:35 PM5/12/22
to VPython-users
The fix is to install an older version of autobahn package and txaio. The steps to fix are to uninstall autobahn and txaio

    conda uninstall autobahn
    conda uninstall txaio

or 

    pip uninstall autobahn
    pip uninstall txaio

Then install autobahn version 21.11.1

    pip install autobahn==21.11.1

and this will install txaio version 22.2.1

These were the versions of autobahn and txaio that existed when vpython 7.6.3 came out.

Vpython should probably create a new release to fix this problem or to use older versions of autobahn and txaio as dependencies.

John

Lehong Wang

unread,
May 12, 2022, 6:46:58 PM5/12/22
to VPython-users
Hi John,

Thank you so much for your help!
Both of your methods worked, like magic!
I can't thank you enough. 

Lehong

Bruce Sherwood

unread,
May 12, 2022, 11:04:22 PM5/12/22
to VPython-users
Great analysis, John! Congratulations!

Bruce
Reply all
Reply to author
Forward
0 new messages