现状为:
在iOS应用中嵌入Python(libpython2.7.a),所有逻辑都由Python编写,通过SWIG封装支持调用一些API。如果Python是py(c,o),一切正常但速度太慢。我想加速,于是使用Cython编译成.c源码然后再生成.so文件,它似乎被加载了,但是
找不到“__file__”定义
以下是调用堆栈:
[CGPLoad.py] load from file error [Error Message:
exceptions.NameError:name '__ file __' is not defined
Traceback:
init CGPLoad (build/CGPLoad.c:3054): CGPLoad.py(# 19)
init LogInOutShell (build/LogInOutShell.c:3089): LogInOutShell.py(# 20)
init CommonToolShell (build/CommonToolShell.c:6560): CommonToolShell.py(# 19)
init GameWorld (build/GameWorld.c:2516): GameWorld.py(# 19)
init IPY_GAMEWORLD (build/IPY_GAMEWORLD.c:27700): IPY_GAMEWORLD.py(# 28)
IPY_GAMEWORLD.swig_import_helper (build/IPY_GAMEWORLD.c:4304): IPY_GAMEWORLD.py(# 18)
]
Python源代码如下:
fp, pathname, description = imp.find_module('_IPY_GAMEWORLD', [dirname(__ file __)])
什么问题?如何解决?
__
和FILE
之间有空格。 - Kevin