[Python-talk] mat3d error
Labitt, Bruce
labittb1 at tycoelectronics.com
Thu Sep 11 13:48:09 EDT 2008
Hmm, in this case it may be an error in someone else's code. I'm trying
to learn from the example, except it appears either it is wrong, or
(more likely) that I set up my computer wrong. Based on my history to
date, I'd say it was me setting things up incorrectly. Of course, both
things could be wrong. :)
For the moment, let us assume I set things up wrong... Here is what I
did, in roughly this order:
1. python install - binary from repository - probably part of the distro
2. Download mat3d.py and mat3d_ex4.py from
http://www.scipy.org/WilnaDuToit
3. Attempt to run. Fail.
4. Install PyOpenGL via
$ sudo easy_install PyOpenGL
5. Install times out due to corporate firewall?
6. Download PyOpenGL from cheeseshop - that worked, go figure.
7. Install PyOpenGL via
$ sudo easy_install PyOpenGL-3.0.0b5.tar.gz
8. Install times out due to corporate firewall
PyOpenGL is looking for ctypes
9. Download ctypes
10. Install ctypes with easy_install
11. Install PyOpenGL same as #7. ==> Do I need to uninstall PyOpenGL
first?
12. Run $ python mat3d_ex4.py
13. Fails requires 'Togl'
14. Install Togl which consists of copying a file libToglstub.a and
/Togl2.0
to /usr/lib/tcl8.4 . That is what the readme said to do...
15. Example in #12 runs and renders figure. Hooray! Panning, resizing
and
rotation all work. That is what I wanted the file for!!!
16. Try to save figure by clicking 'Save' button on tk figure
Exception in Tkinter callback ==> error I posted in 1st msg of
thread
17. Checked to make sure I had PIL installed. Installed it anyways...
Same error upon 'Save' click.
I noticed something during the PIL installation:
-------------------------
version 1.1.6
platform linux2 2.4.3 (#1, Mar 13 2008)
[GCC 4.1.2]
-------------------------
*** TKINTER support not available (Tcl/Tk 8.4 libraries needed)
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
--- FREETYPE2 support ok
-------------------------
To add a missing option, make sure you have the required
library,
and set the corresponding ROOT variable in the setup.py script.
Is this the problem? How do I fix this?
Questions on the above procedure:
So did I screw up the installation? Did I use easy_install correctly?
Why does the connection time out at work - I am being blocked, I
suppose. What connection (port) is being used to connect to cheeseshop?
In other words, what do I tell my IT people?
Do I need to change anything in the file
/usr/lib64/python2.4/config/Setup ?
If I didn't obviously screw up the above then to your questions.
Honestly, I don't know how to answer them. I have about 1 minute
experience with python. Talk about being a noob! Sorry about this
loooong winded post.
-Bruce
-----Original Message-----
From: Python [mailto:python at venix.com]
Sent: Thursday, September 11, 2008 12:53 PM
To: Labitt, Bruce
Cc: python-talk at dlslug.org
Subject: Re: [Python-talk] mat3d error
I'm going to assume an error in your code. I just don't have these
packages in place to test from here.
On Thu, 2008-09-11 at 11:49 -0400, Labitt, Bruce wrote:
> As described earlier, I have this error message when I try to save the
> graphics that the mat3d_ex4.py file generates.
>
> Exception in Tkinter callback
> Traceback (most recent call last):
> File "/usr/lib64/python2.4/lib-tk/Tkinter.py", line 1345, in
> __call__
> return self.func(*args)
> File "/home/me/mypython/mat3d/mat3d.py", line 637, in save
> self.SaveTo(fileName)
> File "/home/me/mypython/mat3d/mat3d.py", line 645, in SaveTo
> data = glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE)
So you are supplying two integers, two variables (also ints?), and two
constants that probably came from the modules and we'll assume are
correct.
> File
"/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0b5-py2.4.egg/OpenGL/GL/i
mages.py", line 323, in glReadPixels
> ctypes.c_void_p( imageData )
> ArgumentError: argument 3: exceptions.TypeError: wrong type
I presume the glReadPixels function is using your arguments to build
imageData and pass that to the ctypes module in preparation for calling
the C libraries. If you can read that function and decipher how your
arguments were processed, that might explain the error. If the argument
order was preserved, width could be the culprit.
What are the width and height values that you are passing in?
If the fix is not obvious, please paste some code from glReadPixels to
show how imageData gets built.
--
Lloyd Kvam
Venix Corp
DLSLUG/GNHLUG library
http://dlslug.org/library.html
http://www.librarything.com/catalog/dlslug
http://www.librarything.com/rsshtml/recent/dlslug
http://www.librarything.com/rss/recent/dlslug
More information about the Python-talk
mailing list