Error in basic extrusion script

18 views
Skip to first unread message

Ted Sheridan

unread,
Apr 11, 2024, 6:39:46 PMApr 11
to VPython-users
Hi all - I'm fairly new to Vpython (using Spyder) but have picked up most of the basics. I just started experimenting with extrusions of 2D shapes to make 3D objects. I'm getting the right results in the graphics window, but not without getting an error response. The script is as basic as possible.  I could just ignore it, but I'm wondering what's going on or if anyone else has had this problems. 

SCRIPT:
from vpython import  shapes,extrusion, vector  

circle = shapes.circle()

circle_path = [vector(0,0,0),vector(1,0,0)]

extrusion(path = circle_path,shape = circle)

ERROR: 

Task exception was never retrieved
future: <Task finished name='Task-14563' coro=<WSserver.onMessage() done, defined at /Users/tedsheridan/opt/anaconda3/lib/python3.9/site-packages/vpython/no_notebook.py:181> exception=TypeError("unsupported operand type(s) for *: 'float' and 'vpython.cyvector.vector'")>
Traceback (most recent call last):
  File "/Users/tedsheridan/opt/anaconda3/lib/python3.9/site-packages/vpython/no_notebook.py", line 214, in onMessage
    await loop.run_in_executor(None, GW.handle_msg, msg)
  File "/Users/tedsheridan/opt/anaconda3/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/tedsheridan/opt/anaconda3/lib/python3.9/site-packages/vpython/vpython.py", line 415, in handle_msg
    cvs.handle_event(evt)
  File "/Users/tedsheridan/opt/anaconda3/lib/python3.9/site-packages/vpython/vpython.py", line 3262, in handle_event
    obj._axis.value = obj._size._x*norm(obj._axis)
TypeError: unsupported operand type(s) for *: 'float' and 'vpython.cyvector.vector'

Bruce Sherwood

unread,
Apr 11, 2024, 7:29:43 PMApr 11
to VPython-users
Works fine for me in Spyder. What do you see when you execute print(version)? What version of Python are you using? What operating system? What browser? Here are the recommend installation instructions from vpython.org:

We recommend installing the Anaconda Python distribution.

The vpython module currently works with Python versions 3.8 through  3.12.

The 3D displays are rendered by WebGL in a browser window. For details, see
    https://vpython.org/contents/VPythonArchitecture.pdf

The vpython module is available using
     "conda install -c vpython vpython" or
     "conda install -c conda-forge vpython" or      
     "pip install vpython"

To update to later versions of vpython use
     "conda update -c vpython vpython" or
     "pip install -U vpython"


Bruce
Reply all
Reply to author
Forward
0 new messages