[visionegg] AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
- From: Nick Knouf <nknouf@xxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Tue, 5 Jul 2005 16:42:07 -0400
hi everybody,
i'm working on getting visionegg up and running with simple RSVP
experiments but seem to have run into a snag.
i'd like to create some textures from tiff files using the Texture
and TextureStimulus classes. The relevant code is below (note that
filelist is a list of lists, each first-level list representing the
images for one particular condition):
stimuli = []
for condition in filelist:
texture_list = [Texture(filename) for filename in condition]
stimuli.append([TextureStimulus(texture = texture, size =
texture.size, texture_min_filter = gl.GL_LINEAR) for texture in
texture_list])
when i try and run that code (in context of a larger script of course
(attached to this message)), I get the traceback at the bottom of the
e-mail.
(i thought the problem might be due to me being fancy with list
comprehensions, but with more verbose code i go the same result.)
note that all visionegg demos work perfectly.
when i grep through the pyopengl sources, i find references to
similar, but not exactly the same, constants:
GL_CLAMP_TO_EDGE_EXT
GL_CLAMP_TO_EDGE_SGIS
this is my version of pyopengl:
DATA
__author__ = 'Tarn Weisner Burton
<twburton@xxxxxxxxxxxxxxxxxxxxxxxxx ...
__build__ = 1
__date__ = '2004/11/14 23:33:24'
__numeric_present__ = 0
__numeric_support__ = 1
__version__ = '2.0.2.01'
any information as to what's going on, or a way to work around this
problem?
thanks,
nick knouf
2005-07-05 16:34:23,217 (830) INFO: Script test_rsvp.py started
Vision Egg 1.0-cvs with process id 830.
2005-07-05 16:34:23,218 (830) INFO: ====== beginning test_rsvp.py ======
2005-07-05 16:34:23,281 (830) CRITICAL: Traceback (most recent call
last):
File "test_rsvp.py", line 103, in ?
stimuli = create_textures_from_filelist(filelist, 4, 20)
File "test_rsvp.py", line 82, in create_textures_from_filelist
stimuli.append([TextureStimulus(texture = texture, size =
texture.size, texture_min_filter = gl.GL_LINEAR) for texture in
texture_list])
File "/Users/Shared/Library/Python/2.3/lib/python2.3/site-packages/
VisionEgg/Textures.py", line 1133, in __init__
self.parameters.texture_wrap_s = gl.GL_CLAMP_TO_EDGE
AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
Traceback (most recent call last):
File "test_rsvp.py", line 103, in ?
stimuli = create_textures_from_filelist(filelist, 4, 20)
File "test_rsvp.py", line 82, in create_textures_from_filelist
stimuli.append([TextureStimulus(texture = texture, size =
texture.size, texture_min_filter = gl.GL_LINEAR) for texture in
texture_list])
File "/Users/Shared/Library/Python/2.3/lib/python2.3/site-packages/
VisionEgg/Textures.py", line 1133, in __init__
self.parameters.texture_wrap_s = gl.GL_CLAMP_TO_EDGE
AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
# Copyright (C) 2004 nick knouf <nknouf@xxxxxxx>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# $Id: __init__.py,v 1.2 2004/10/12 01:00:16 commit Exp $
#
__author__ = "Nick Knouf <nknouf@xxxxxxx>"
__version__ = "$Revision: 1.2 $"
__date__ = "$Date: 2004/10/12 01:00:16 $"
__copyright__ = "Copyright 2004, MIT, Nick Knouf"
__license__ = "GPL2"
# standard python imports
import glob, sys
# visionegg imports
from VisionEgg import *
from VisionEgg.Core import *
from VisionEgg.FlowControl import Presentation, FunctionController
from VisionEgg.Textures import *
import OpenGL.GL as gl
# for now, append our library development directory to the path and load
# the neccessary classes/methods
sys.path.append('/Users/nknouf/Development/VisionEgg_work')
from nklab.experiments.exceptions import *
# setup the logging interface
start_default_logging()
# properly deal with exceptions
watch_exceptions()
# get our name
script_name = sys.argv[0]
# list of stimulus directories
stimuli_locations = ['1 faces', '2 houses', '3 scenes', '4 objects']
def write_to_log(level="info", message=""):
if not level.upper() in VisionEgg.logging._levelNames:
raise TypeError, "'level' given is not in the allowed range of python
logging levels'"
# write using the appropriate logging level function
logging_function = getattr(VisionEgg.logger, level, "info")
logging_function(message)
def create_textures_from_filelist(filelist, number_of_conditions,
stimuli_number):
"""Create a set of OpenGL Textures from the list of stimuli given in
`filelist`. The order of Textures is the same as in the original
`filelist`. Also, perform a sanity check that the number of sets of files
is the same as `number_of_conditions`.
Returns a list of lists of Textures."""
stimuli = []
# sanity check the number of conditions
if len(filelist) != number_of_conditions:
raise nklabInvalidSizeError, "The number of elements in the filelist
(%d) is not the same as the number of conditions given (%d)." % (len(filelist),
number_of_conditions)
# sanity check the amount of stimuli
for condition in filelist:
if len(condition) != stimuli_number:
raise nklabInvalidSizeError, "The number of elements in the list of
stimuli (%d) is not the same as the desired number of stimuli given (%d)." %
(len(condition), stimuli_number)
for condition in filelist:
texture_list = [Texture(filename) for filename in condition]
stimuli.append([TextureStimulus(texture = texture, size = texture.size,
texture_min_filter = gl.GL_LINEAR) for texture in texture_list])
return stimuli
def get_filelist(directory_list, filter="*.*"):
"""For each directory in `directory_list`, get a list of files.
Optionally, filter by filter `filter`.
Returns a list of lists, `filelist`, where each element in the list is a
list of files of the respective directory in the original `directory_list`."""
filelist = []
for directory in directory_list:
filelist.append(glob.glob('%s/%s' % (directory, filter)))
return filelist
write_to_log(level="info",
message="====== beginning %s ======" % script_name)
filelist = get_filelist(stimuli_locations)
stimuli = create_textures_from_filelist(filelist, 4, 20)
write_to_log(level="info",
message="====== ending %s ======" % script_name)
- Follow-Ups:
- [visionegg] Re: AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
- From: Andrew Straw
- [visionegg] Re: AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
- From: Jascha Swisher
- [visionegg] Re: AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
- From: Bertrand Guay-Paquet
Other related posts:
- » [visionegg] AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
- » [visionegg] Re: AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
- » [visionegg] Re: AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
- » [visionegg] Re: AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
- » [visionegg] Re: AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
- [visionegg] Re: AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
- From: Andrew Straw
- [visionegg] Re: AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
- From: Jascha Swisher
- [visionegg] Re: AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
- From: Bertrand Guay-Paquet