skaslev / gl3w

Simple OpenGL core profile loading
http://github.com/skaslev/gl3w
The Unlicense
705 stars 157 forks source link

Error when calling gl3w_gen.py #37

Closed cmourglia closed 8 years ago

cmourglia commented 8 years ago

The script was working recently (like 15 days ago or less), but yesterday and today I got a weird error

Downloading glcorearb.h to include/GL...
Traceback (most recent call last):
  File "gl3w_gen.py", line 83, in <module>
    web = urllib2.urlopen('https://www.opengl.org/registry/api/GL/glcorearb.h')
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1241, in https_open
    context=self._context)
  File "/usr/lib/python2.7/urllib2.py", line 1198, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>

I have no idea if this comes from me, from gl3w_gen.py or from opengl.org, but it would be great if I could get it working again, do you have any ideas where I could start ?

Thanks

EDIT: I got it working by using this link : http://stackoverflow.com/a/28052583/4717805

I replaced

# Download glcorearb.h
if not os.path.exists('include/GL/glcorearb.h'):
    print('Downloading glcorearb.h to include/GL...')
    web = urllib2.urlopen('https://www.opengl.org/registry/api/GL/glcorearb.h')
    with open('include/GL/glcorearb.h', 'wb') as f:
        f.writelines(web.readlines())
else:
    print('Reusing glcorearb.h from include/GL...')

by

import ssl
# stuff
# ...

# Download glcorearb.h
if not os.path.exists('include/GL/glcorearb.h'):
    print('Downloading glcorearb.h to include/GL...')
    context = ssl._create_unverified_context()
    web = urllib2.urlopen('https://www.opengl.org/registry/api/GL/glcorearb.h', context=context)
    with open('include/GL/glcorearb.h', 'wb') as f:
        f.writelines(web.readlines())
else:
    print('Reusing glcorearb.h from include/GL...')

and got it running perfectly

skaslev commented 8 years ago

This should be fixed after https://github.com/skaslev/gl3w/pull/38