如何停止Py_Initialise应用程序的崩溃?
From VBA and VB6 I'm calling a dll the creates a Python interpreter. If I set the PATH
environment variable to point to "C:\python27"
and PYTHONPATH
to "c:\python27\lib"
all is fine.
我从VBA和VB6调用一个dll来创建一个Python解释器。如果我将PATH环境变量设置为指向“C:\python27”,并将PYTHONPATH设置为“C:\python27 \lib”,一切都没问题。
If I don't set the PATH
then calling Py_Initialise()
crashes XL or my VB6 app, even if I call Py_SetProgramName
with "c:\python27\python27.exe"
first.
如果我没有设置路径,那么调用Py_Initialise()会崩溃XL或我的VB6应用程序,即使我用“c:\python27\python27”调用Py_SetProgramName。exe”放在第一位。
I'd like to specify the installation in VB/VBA rather than having it set in the environment as I can't do that in XL (works ok for VB6).
我希望在VB/VBA中指定安装,而不是在环境中设置,因为在XL中不能这样做(适用于VB6)。
3 个解决方案
#1
3
The best answer I've found so far is that it is a bug in Python - http://bugs.python.org/issue6498. The intepreter seems to call exit() on certain errors rather than passing a code back to the caller. Not very friendly if you're embedding python in an app. But there you go.
到目前为止,我发现的最好的答案是它是Python中的一个bug——http://bugs.python.org/issue6498。intepreter似乎在某些错误上调用exit(),而不是将代码返回给调用者。如果你在应用程序中嵌入python,那就不太友好了。
更多相关文章
- Gunicorn + Django + Heroku。Python的路径问题
- py2exe使用相对路径的当前目录问题
- tensorflow 变量定义路径//问题
- python在windows中的文件路径问题
- 轮询Web服务的最佳方式(例如,对于Twitter应用程序)
- 乘客的Django应用程序显示空主页
- Python添加默认模块搜索包路径
- 如何获得正在运行的Python脚本的路径?(复制)
- 用于在Google App Engine上构建应用程序的最佳开源IDE?