VPython Common Errors and Troubleshooting: Difference between revisions

From Physics Book
Jump to navigation Jump to search
No edit summary
No edit summary
Line 19: Line 19:
<div style="clear: both"></div>
<div style="clear: both"></div>


=== ImportErrors of various forms ===
=== ImportError: No module named "*" ===


  Traceback (most recent call last):
  Traceback (most recent call last):

Revision as of 11:22, 3 December 2015

(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