Given a 3.0+ forward-compatible context, that is, with glGetString barking at GL_EXTENSIONS, "from OpenGL.GL import *" may fail if one of OpenGL.GL.VERSION.GL_* submodules with version below 3.0 calls hasGLExtension() due to the fact that until "from OpenGL.GL.VERSION.GL_3_0 import *" line is executed in OpenGL/GL/__init__.py, the line "from OpenGL.GL import GL_NUM_EXTENSIONS, glGetStringi, glGetIntegerv" is guaranteed to throw an ImportError.
replace the aforementioned import statement in the hasExtension() function with the following two lines:
from OpenGL.GL.VERSION.GL_3_0 import GL_NUM_EXTENSIONS, glGetStringi
from OpenGL.GL import glGetIntegerv
Works for me.
Attached patch: the above fix plus a couple of nits to make it all work under Python 3.2