2005年04月26日 星期二 21:58
现在正在写将Python导入到BCB中的程序,遇到下面的问题。
我的Python程序需要导入一个模块,但是这个模块如果是Python自己带的,如string等就没有问题,但是如果导入的模块是ElementTree等第三方的模块,就会有问题,我的代码如下:
PyImport_ImportModule("ElementTree");
pCall = PyImport_ImportModule("SmtLine");
DataFile = DataPath + "SmtLine.xml";
pResult = PyObject_CallMethod(pCall, "GetInitData", "(s)", DataFile.c_str
());
TreeData = PyString_AsString(pResult);
ShowMessage(TreeData);
pCall的返回值不是NULL,但是pResult
的返回值就是NULL了,调试了一下Python代码,发现代码中在与ElementTree相关的开始处就有问题了。我怀疑是我的这种模块导入方式有问
题。试了另外一种方法,直接在代码中import ElementTree也是有问题,不过Python代码可以独立执行。
谁能告诉我,我的代码在哪里有问题?
--
My Blog >> http://leejd.cndev.org
My QQ >> 9847243
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050426/bae9ef7d/attachment.htm
2005年04月27日 星期三 01:39
, 您好! ************下面是转发邮件************ 原邮件发件人名字: 胡兴洋 原邮件发件人地址:hu.007 at 163.com 原邮件收件人名字:mod_python 原邮件收件人地址:mod_python at modpython.org 原邮件抄送人名字: 原邮件抄送人地址: >Hello! > > How to solve this problem? I have the same. > mine: FreeBSD5.4rc3 + apache2.0.53 + python2.3 + mod_python3.1.4. > http://www.modpython.org/pipermail/mod_python/2005-January/017113.html > >Thanks! > > >_______________________________________________ >Mod_python mailing list >Mod_python at modpython.org >http://mailman.modpython.org/mailman/listinfo/mod_python > = = = = = = = = = = = = = = = = = = = = 致 礼! 胡兴洋 hu.007 at 163.com 2005-04-27
Zeuux © 2025
京ICP备05028076号