The Python module can't handle https with urllib.request

The code:

from urllib import request
url = ''
with request.urlopen(url) as response:
    idsData =

The error info:

urllib.error.URLError: <urlopen error unknown url type: https>

Seems like the module is not the complete package. The ssl part is missing.

That seems to be a problem with python, not with glyphs. I get the same error when running this code outside of Glyphs.

OK. I just found my python(build by homebrew) was compiled with ssl module.
I’ll find a way out. :crazy_face:

Hey @coltma

Have you figured it out? I’m facing a similar problem.

If python doesn’t work, you could use ObjectiveC. That should work. If it is a really small file you can load it synchronously:

url = NSURL.URLWithString_("URL/api/product")
data = NSData.dataWithContentsOfURL_(url)

If you need to load more you could try this: URL loading system in Objective-C (it is written in ObjetiveC, but you should be able to convert that to python.

1 Like