VPython Common Errors and Troubleshooting

From Physics Book
Revision as of 11:25, 3 December 2015 by Lucasec (talk | contribs)
Jump to navigation Jump to search

(Lucas Christian, page 1 of 2)

This reference lists out some common errors I've seen students encounter while working in VPython. Programming languages can often generate obscure and confusing error messages, and VPython is no exception.

System/Environment Errors

If your system is not set up correctly, or the environment you are running VPython code is incorrect, a number of mysterious errors can result.

VPython does not start or immediately freezes

Make sure you are running your code in VIDLE (not the identical-looking IDLE).

Use VIDLE instead of IDLE to avoid errors and crashes.

With the most current releases of VPython, code compiles and launches fine in IDLE, but the graphics window comes up grey and hangs. This is because of a bug in the way regular IDLE executes code, it has difficulty with programs that keep running in a loop, as VPython does so you can drag and zoom the display.

Note that if you double-click a .py file in Windows Explorer or Finder, it may open up in the regular IDLE instead of VIDLE. To check if your code is open in VIDLE, click the "Help" menu and look for the "VPython" menu item. Regular IDLE does not have a "VPython" item in the Help menu.

ImportError: No module named *

Traceback (most recent call last):
  File "/my/documents/folder/vectors.py", line 1
    from future import division
ImportError: No module named future

Syntax Errors

(work in progress; will cover common syntax errors)

Runtime Errors

(work in progress; will cover various messages involving errors in vector operations, etc.)