Issue
I'm using GAE sandbox on Windows, python 2.7 and virtualenv. When I try to use Requests lib, I'm getting the following error:
global name '_dlopen' is not defined
Full stack:
INFO 2017-09-20 13:40:20,551 module.py:821] default: "GET / HTTP/1.1" 500
from ctypes import (c_buffer, POINTER, byref, create_unicode_buffer,
File "c:\python27\Lib\ctypes\__init__.py", line 450, in <module>
pythonapi = PyDLL(None)
File "c:\python27\Lib\ctypes\__init__.py", line 362, in __init__
self._handle = _dlopen(self._name, mode)
NameError: global name '_dlopen' is not defined
GAE on windows did have issues with loading ctypes and and winreg but it's now whitelisted on development environment automatically.
What am I missing?
Solution
So I found what caused the issue: It was the workaround suggested in https://stackoverflow.com/a/25915535/3767514
The problem was that changing os.name=None
meant ctypes cannot use the correct dll load library.
ctypes init line 457:
if _os.name in ("nt", "ce"):
windll = LibraryLoader(WinDLL)
so the solution was importing ctypes before changing the os.name to None in appengine_config.py:
import os
if os.name == 'nt':
import ctypes
os.name = None
Answered By - Crispy Holiday Answer Checked By - Mildred Charles (WPSolving Admin)