As David implied, the fact that you changed the import statement (getting rid of the ugly "import *") has nothing to do with the fact that your script is executed successfully or not. This warning message is just about Python programming guidelines, that's all.
Now, I've tried to run this script as I have both VPython and Spyder installed, and the program runs smoothly, as many times as I want with both Spyder v2.1.10 and v2.2.0dev. In other words, I can't reproduce this bug. Note: for my tests, I ran the script in a dedicated interpreter. If you are trying to rerun the script again and again in the same interpreter, then it's normal that the interpreter quits after its first execution (it's related to VPython internals). Don't forget that VPython is tweaking IDLE to make some things work (I don't really know the details, I just remember seing a patch for IDLE in VPython installer). HTH, Pierre 2012/7/25 pai <[email protected]>: > As you have proposed, I modified the first line to: > from visual import box, sphere, color, vector, rate > This lead to a clean script without any spyder warning and a successful run, > and only ONE. When I tried to rerun the script by pressing F5, nothing > happen. My conclusion is maybe spyder isn't friendly enought to some > modules, such as Vpython. > > > 在 2012年7月25日星期三UTC+8上午11时36分54秒,David写道: >> >> The message you reported is just a warning, you can ignore it if you want. >> Did you actually try running the script? >> >> The reason for the warning is the line "from visual import *", which >> imports a whole bunch of things from the library, which spyder doesn't know >> about. This means that spyder's code cannot do clever things like detecting >> whether you have called an undefined function and displaying a warning about >> it in the editor. >> >> On Tuesday, 24 July 2012 15:26:34 UTC+10, pai wrote: >>> >>> I'm have installed Python(x,y)-2.7.2.3 on Win7 32-bit system to draw a >>> simple 3D animation with vpython module. The script is shown as following, >>> but the spyder complains with an exclamation mark at the first line of the >>> script and hint shows that 'from visual import *' used; unable to detect >>> undefined names. The script runs pretty well in IDLE, so I'm sure the >>> problem came from spyder. Can anyone helps me, please ? >>> >>> >>> >>> from visual import * >>> >>> floor = box (pos=(0,0,0), length=4, height=0.5, width=4, >>> color=color.blue) >>> >>> ball = sphere (pos=(0,4,0), radius=1, color=color.red) >>> >>> ball.velocity = vector(0,-1,0) >>> >>> dt = 0.01 >>> >>> while 1: >>> >>> rate (100) >>> >>> ball.pos = ball.pos + ball.velocity*dt >>> >>> if ball.y < ball.radius: >>> >>> ball.velocity.y = abs(ball.velocity.y) >>> >>> else: >>> >>> ball.velocity.y = ball.velocity.y - 9.8*dt > > -- > You received this message because you are subscribed to the Google Groups > "spyder" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/spyderlib/-/3JCmBhxH5mYJ. > > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/spyderlib?hl=en. -- You received this message because you are subscribed to the Google Groups "spyder" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.
