@omz Following code raises an AttributeError in Pythonista:
import ctypes
print ctypes.pythonapi.PyThreadState_SetAsyncExc
In Pythonista, the error is AttributeError: dlsym(RTLD_DEFAULT, PyThreadState_SetAsyncExc): symbol not found.
But it works with PC version Python and the correct output should be something <_FuncPtr object at 0x10223be20>
I looked into __init__.py of the ctypes module and found following code
if _os.name in ("nt", "ce"):
pythonapi = PyDLL("python dll", None, _sys.dllhandle)
elif _sys.platform == "cygwin":
pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2])
else:
pythonapi = PyDLL(None)
Apparently, the else clause should take effect. Since the Pythonista environment is quite special, are there some settings missing in the DLL initialisation? I tried PyDLL('libpythonista.a') but got error image not found.
Any tips?