From: Bruce S. <Bru...@nc...> - 2011-05-25 02:04:33
|
For someone "very very very new" to this, you ask your question very knowledgeably. From the first page of the VPython documentation: As a convenience to novice programmers to provide everything that is needed to get started, the statement "from visual import *" imports all of the Visual features and executes "from math import *" and "from numpy import *". It also arranges that for routines common to both math and numpy such as sqrt, the much faster math routine is used when possible (when the argument is a scalar rather than an array). If you want to import the visual objects selectively, import them from the vis module. Two simple examples: import vis vis.box(color=vis.color.orange,material=vis.materials.wood) from vis import (box, color, materials) box(color=color.orange, material=materials.wood) There are clean modules vis.controls, vis.filedialog, and vis.graph equivalent to the modules visual.controls, visual.filedialog, and visual.graph. The latter versions execute "from visual import *" and are retained because some programs expect that behavior when importing one of these modules. The documentation is written assuming that "from visual import *" is used. Bruce Sherwood On Tue, May 24, 2011 at 1:28 PM, Eric Dick <mon...@ma...> wrote: > Hello, > I recently installed the VPython v.3.1 and corresponding Python versions for > mac (OSX). I've been troubleshooting an old script of mine when I noticed > some odd behavior. > When I run my script, a line tries to import random. Oddly the shell > reports that its using a file from numpy rather than from > ~/python3.1/random.py. If I try to import random manually in the shell it > grabs the correct module from ~/python3.1/random.py. > A. Python Shell >>>> import random >>>> print (random.__file__) > /Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/random.py > B. Script File >>>> print (random.__file__) > /Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/numpy/random/__init__.py > Does anyone know how to fix this? Also does anyone know what is going on? > Please reply with complete instructions, as I am very very very new to all > of this. > Thank you all in advance! > ------------------------------------------------------------------------------ > vRanger cuts backup time in half-while increasing security. > With the market-leading solution for virtual backup and recovery, > you get blazing-fast, flexible, and affordable data protection. > Download your free trial now. > http://p.sf.net/sfu/quest-d2dcopy1 > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > |