Forum Archive

[Bug] Pythonista on iPhone ctypes not loading properly

blmacbeth

When initially opening Pythonista on my iPhone 6 and try to load ctypes from a script (or in the console) I get a NotImplementedError. I solve this by opening a file in the ObjC examples folder. Just wanted to let y'all know and see if it is happening to anyone else.

B

JonB

this is just import ctypes? I am skeptical... do you have a ctypes.py where it doesn't belong?

blmacbeth

Output from the console:

>>> import ctypes
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/mobile/Containers/Shared/AppGroup/FF0B1A40-8BD7-4671-9654-179C13AC560F/Documents/temp/ctypes.py", line 4, in <module>
    from ctypes import c_void_p, c_char_p, c_double, c_float, cdll, util
ImportError: cannot import name c_void_p

This is right after restarting Pythonista. I can import _ctypes however. This does let me import ctypes.

ctypes is in Standard Library/ctypes

omz

It looks like you have a script of your own called ctypes.py in a "temp" folder. Naming your scripts like built-in modules is never a good idea, try renaming it to something like ctypes_tests.py (and restart Pythonista if that doesn't help right away).