Can't import the ctypes python library in Google App Engine

[亡魂溺海] 提交于 2020-01-16 14:06:14

问题


I can't import ctypes on the production GAE server, which is causing our code to break. Seemingly, urllib and urllib2 also rely on this library, but somehow it's possible to import them on production through the console (e.g. navigate to www.myapp.com/console). Is this a feature or a bug? Thanks!

Python 2.5.2 (r252:60911, Mar 17 2011, 15:16:30) 
[GCC 4.3.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(Google App Engine/1.5.1)
>>> from lib import cloud
 Traceback (most recent call last):
  File "/base/data/home/apps/s~getprofound1/1-01.351465921648985319/console/app/models/console.py", line 170, in processSource
    exec bytecode in statement_module.__dict__
  File "<string>", line 1, in <module>
  File "/base/data/home/apps/s~getprofound1/1-01.351465921648985319/lib/cloud/__init__.py", line 102, in <module>
    from . import cloudconfig as cc
  File "/base/data/home/apps/s~getprofound1/1-01.351465921648985319/lib/cloud/cloudconfig.py", line 50, in <module>
    from .util import configmanager
  File "/base/data/home/apps/s~getprofound1/1-01.351465921648985319/lib/cloud/util/__init__.py", line 25, in <module>
    import ctypes
  File "/base/python_runtime/python_dist/lib/python2.5/ctypes/__init__.py", line 10, in <module>
    from _ctypes import Union, Structure, Array
ImportError: No module named _ctypes

回答1:


ctypes is not available in the Python 2.5 runtime or in the current Python 2.7 runtime. See the knowledge base for more details and this list enumerating white-listed module.



来源:https://stackoverflow.com/questions/6515151/cant-import-the-ctypes-python-library-in-google-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!