From: Guenter S. <Gue...@ph...> - 2009-09-17 19:18:56
|
Thank you for pointing me to pycrust. I can confirm the correct behavior on my 'ATI' computer using it. It is very strange indeed. I wouldn't call it a fix but it is a workaround. Guenter Jim Thomas wrote: > When I run python on the command line I get segfaults like so: > > jim@jtws:~$ python > Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18) > [GCC 4.3.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> from visual import * > >>> v = vector('x') > Segmentation fault > jim@jtws:~$ > > jim@jtws:~$ python > Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18) > [GCC 4.3.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> from visual import * > >>> v = vector(1,2,3) > >>> for i in v: > ... print i > ... > 1.0 > 2.0 > 3.0 > Segmentation fault > jim@jtws:~$ > > However, this is interesting. When I run in PyCrust (distributed as > part of wxPython) I get this instead: > > PyCrust 0.9.5 - The Flakiest Python Shell > Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18) > [GCC 4.3.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> from visual import * > >>> v = vector('x') > Traceback (most recent call last): > File "<input>", line 1, in <module> > ArgumentError: Python argument types in > vector.__init__(vector, str) > did not match C++ signature: > __init__(_object*, cvisual::vector) > __init__(_object*) > __init__(_object*, double) > __init__(_object*, double, double) > __init__(_object*, double, double, double) > >>> > >>> v = vector(1,2,3) > >>> for i in v: > ... print i > ... 1.0 > 2.0 > 3.0 > >>> > > So basically it works fine so long as I'm using PyCrust. This would > explain why I have not seen this as a problem since I rarely use the > command line Python. I'm not quite sure what type of exception visual > is throwing in the first test but I can catch it: > >>> try: > ... v = vector('x') > ... except Exception as inst: > ... print 'Exception Caught' > ... print inst > ... Exception Caught > Python argument types in > vector.__init__(vector, str) > did not match C++ signature: > __init__(_object*, cvisual::vector) > __init__(_object*) > __init__(_object*, double) > __init__(_object*, double, double) > __init__(_object*, double, double, double) > >>> > > Hopefully this helps. it seems to me the simplest fix for you might > just be to install wxPython and your students use > PyShell/PyCrust/PyAlamode for code development. > > JT > > Guenter Schneider wrote: >> What happens on your system if you run the 2 tests below? I agree it >> is not a show shopper if you are an experienced programmer. The only >> thing I can't do is iterate over vector elements (which is what caught >> my attention). The matter is not so nice in a computational lab with >> novice programmers who get a seg.fault instead of an error message. It >> is also very annoying if you use vpython interactively. >> >> Guenter >> >> Jim Thomas wrote: >>> Gee, I thought I had VPython working just fine on Ubuntu 9.04 AMD64 >>> on ATI proprietary until I ran your tests. However since I was able >>> to develop my VisualPyODE library and demos without problems on this >>> platform, maybe it is not such a show stopper. I hadn't even noticed... >>> >>> JT >>> >>> Guenter Schneider wrote: >>>> I have struggled to get vpython fully working on ubuntu for a while >>>> now. Here is my summary what I learned. Let me say right away, as >>>> far as I can tell it's not a vpython problem. >>>> >>>> First, unlike others on this list, I have no problems compiling >>>> vpython 5.12. It works using debian Lenny on any computer I have >>>> tried. By >>>> 'it works' I mean these simple tests do not result in seg. faults: >>>> >>>> TEST 1: >>>> >>> from visual import * >>>> >>> v = vector('x') >>>> Traceback (most recent call last): >>>> File "<stdin>", line 1, in <module> >>>> ValueError: Vectors must be constructed from sequences of 2 or 3 >>>> float members. >>>> >>> >>>> >>>> TEST 2: >>>> >>> from visual import * >>>> >>> v=vector(1,2,3) >>>> >>> for i in v: >>>> ... print i >>>> ... >>>> 1.0 >>>> 2.0 >>>> 3.0 >>>> >>> >>>> >>>> On ubuntu 9.04 it works on some computers but not on others. It >>>> doesn't matter if I use 32 bit or 64 bit ubuntu 9.04. >>>> >>>> In fact the same pattern holds true in my tests for the >>>> python-visual package that is distributed with ubuntu 9.04 (which is >>>> vpython 3.2.9). It fails on all computers if a proprietary graphics >>>> driver is not installed. Activating an nvidia proprietary graphics >>>> driver results in a working vpython (as defined above), on system >>>> with ati graphics cards I was not so lucky. I tried 6 different >>>> computers, 2 with nvidia graphics and 4 with ati graphics. >>>> >>>> I got the same result for ubuntu 8.10. It always works with ubuntu >>>> 8.04.3. >>>> >>>> I filed a bug report with ubuntu against vpython since I have no >>>> idea what is causing this problem. >>>> >>>> I could not try python-visual on karmic alpha (which 5.11) since >>>> that leads to a seg fault like this >>>> >>>> >>> from visual import * >>>> Segmentation fault >>>> >>>> There is already a bug report for this. >>>> >>>> Guenter >>>> >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> >>>> Come build with us! The BlackBerry® Developer Conference in SF, CA >>>> is the only developer event you need to attend this year. Jumpstart >>>> your >>>> developing skills, take BlackBerry mobile applications to market and >>>> stay ahead of the curve. Join us from November 9-12, 2009. >>>> Register now! >>>> http://p.sf.net/sfu/devconf >>>> _______________________________________________ >>>> Visualpython-users mailing list >>>> Vis...@li... >>>> https://lists.sourceforge.net/lists/listinfo/visualpython-users >>>> >>> > |