pythonimportruntime-errorvpython

Getting an error when running import vpython, can someone help me out?


Installed vpython via cmd: c:\Users>pip install vpython

Using Python 3.9.9

After installation I tested in cmd using python -m vpython.test and got the following error:

PS H:\Preston\folders\programming\py\vpython> python -u "h:\Preston\folders\programming\py\vpython\intro.py"

exit

Error in atexit._run_exitfuncs:
Traceback (most recent call last):

  File "C:\Users\Preston\AppData\Local\Programs\Python\Python39\lib\site-packages\vpython\vpython.py", line 22, in Exit

    a = 1.0/zero

ZeroDivisionError: float division by zero

Solution

  • The error is not in the import the code works fine, but if you read the error "ZeroDivisionError: float division by zero" your code is dividing by zero try to change your code to something like if(zero==0): print("this is mathematically wrong") else: a = 1.0/zero