Visual Python crashing

259 views
Skip to first unread message

shlomo swendelberg

unread,
Sep 9, 2017, 2:27:35 PM9/9/17
to VPython-users
I created a fairly complex program that generates a gigantic universe of stars made of the vectors of different shapes.  And I had it running great, for such a large scale 3d environment it loaded and ran smoothly.  I went to go have a victory coffee and when I returned it would not work, the shell shows it as working but the visual display crashes.  I thought maybe I had fudged something right before I had saved it so I spent the next 2 weeks debugging.  Only there are no bugs that I can find.  The program runs, all diagnostic print() statements confirm that there arent any loops that are getting trapped.  

So then I thought it was something fundamental.. maybe the math I was using was just too complex for my machine.  So I created a new program that performed the same task but on a very small scale.  Same problem, it runs but the visual display crashes.  So then I tried something very simple

box()

nope doesnt work

sphere() 

nope

Went through the example programs..  They work but only some of the time and only a couple will work.  So I uninstalled python and visual python and then reinstalled both.  Same problem still remains.  What gives?

I am running Python 2.7 with Visual Python 6 .

Bruce Sherwood

unread,
Sep 9, 2017, 7:42:13 PM9/9/17
to VPython-users
It might be useful (but maybe not) to know what platform you're using -- Linux, Mac, Windows?

It certainly sounds like a problem with your computer, not with VPython 6, because you report that some programs run, but not reproducibly. One real possibility is that you need to update your graphics driver, as a problem in that area might well make itself felt in just the way you describe.

shlomo swendelberg

unread,
Sep 9, 2017, 11:21:54 PM9/9/17
to VPython-users
oops forgot to include that information.

This is happening on two computers.  One is running 32 bit Windows 7 and the other 64 bit Windows 7.  On both computers Visual Python ran fine until I tested my finished program.  The windows 7 32 bit computer is the one that I wrote the program on.  It ran the program once but after that visual python started acting all wonky.  Python itself runs fine.  My drivers are all up to date but just incase I just reinstalled everything to make sure.  Fresh install on drivers and python & visual python.  Same problem.  Some of the example programs will run some of the time.  If I copy an example to a new file it will not run at all.  

The program that I was writing was purely math functions + the output of those math functions going to 3d shapes.  No file writing or anything like that just very complicated math with large numbers.  

Does visual python install any files in a folder other than the python folder that I could have missed when I uninstalled?  Because aside from that Im at a complete and total loss right now.

John

unread,
Sep 10, 2017, 3:06:09 PM9/10/17
to VPython-users
Try running the simple program with a rate and a while loop. You said you tried 

sphere()

but the complete program should be

from visual import *
sphere()
while 1:
      rate(100)

See if this simple program works.

John

Bruce Sherwood

unread,
Sep 10, 2017, 4:31:21 PM9/10/17
to VPython-users
No, a loop is not needed. In either VPython 6 or VPython 7 the one-line program "sphere()" works fine and even enables mouse actions to zoom and rotate. It's only when you have an ongoing animation that you need a loop containing a rate statement.

To address the question of what files are present with VPython 6: In C:/Python27/Lib/site-packages you should see the following folders:

numpy, Polygon, ttfquery, vidle, vis, visual, visual_common, and wx-3.0-msw.

In addition there are these files in site-packages:

FontTools.pth, wx.pth, and wxversion.py (and two files that presumably don't matter, numpy and Polygon .egg-info files)

A possible problem is that the VPython 6 installer installs numpy without (I think) checking whether there is already a numpy installed. 

Another possible problem is that if you don't let the Python installer install onto the C drive, there can be failures.

Yet another possibility: When you reinstalled Python and/or VPython, did you use the installers you had already downloaded? If so, it would be prudent to download fresh copies and try again, on the chance that something went wrong in the original download.

Finally, you could try VPython 7 or GlowScript VPython.

Bruce

John

unread,
Sep 10, 2017, 7:31:50 PM9/10/17
to VPython-users
I find that if I run the following code in IDLE

from visual import *
sphere()

then the VPython window pops up with a grey screen and at the top of the window in the title it says 

 VPython (Not Responding)

However if I add the while loop and a rate statement and run the program then the sphere appears in the VPython window and it works fine.

from visual import *
sphere()
while 1:
     rate(100)

I am running on a Windows 7 machine and I am running vpython 6 in its own python virtual environment using anaconda and python version 2.7.13.

If this doesn't help you could try using Anaconda python or miniConda to try running VPython with Anaconda python.


After you install miniconda or anaconda you can create a python virtual environment running python 2.7 and call it something like vp6 for VPython version 6 from the Windows Command Prompt window.

conda create -n vp6 python=2.7  pip

Then activate this python virtual environment with the command

activate vp6

then install VPython into this python virtual environment.

conda install -c mwcraig vpython

After vpython is installed run IDLE and the above program to display a sphere.


John

Bruce Sherwood

unread,
Sep 10, 2017, 7:53:29 PM9/10/17
to VPython-users
Ah. Now I understand. There is a bug in IDLE that makes VPython 6 have problems such as the one you report. VIDLE fixes those problems. In my notes I was assuming the use of VIDLE, since the installation instructions at vpython.org call for its use.

Bruce Sherwood

unread,
Sep 10, 2017, 8:27:26 PM9/10/17
to VPython-users
This raises the question for Shlomo: How do you launch VPython 6?

Reply all
Reply to author
Forward
0 new messages