Can't import modules

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Sep 30 21:25:29 EDT 2012


On Sun, 30 Sep 2012 17:35:02 -0700, Peter Farrell wrote:

> Thanks for trying to help, everybody. Sorry I didn't post the whole
> error message. Now my problem is I just installed VPython and I'm trying
> to run the very first example, bounce.py which I located. I opened it
> and ran it in Idle. I got this message:

In general, any time you get unexpected or unusual errors in IDLE, you 
should try running the same code without IDLE, just at the regular Python 
prompt. Like all "Integrated Development Environments", IDLE sometimes 
messes about with things in the background that very occasionally 
interferes with the normal running of certain Python code, so it is 
always worth taken IDLE out of the picture whenever there is a mysterious 
failure. 

In Windows, I *think* that if you run "python" (or perhaps "python32") 
from the Start Menu, it will open an interactive prompt similar to IDLE. 
Once the Python interactive interpreter has launched, just enter:

from visual import *

and see if it works. If it fails, try:

import visual


My wild guess is that VPython (whatever that is!) only works under Python 
2, not Python 3, but I could be wrong.

Other than that, my advice is to check with a dedicated VPython mailing 
list. Oh, and if you do find the solution, please consider reporting what 
the solution is back here, for the benefit of the next person who runs 
into this issue.



-- 
Steven



More information about the Python-list mailing list