En Wed, 13 Jun 2007 12:03:00 -0300, Robert Bauck Hamar  
<[EMAIL PROTECTED]> escribió:

> Allen wrote:
>
>> I use try catch, but cannot catch the execeptions of execution python
>> method.
>
> No. CPython is written in C, not C++, and C has no concept of exceptions.
> Exceptions in Python is usually indicated by return value in the
> interpreter, and has no mapping to the C++ exception model. You should
> never let C++ exceptions propagate into the python functions either.
> PyImport_ImportModule will return NULL if an exception occured, and so  
> will
> also PyObject_GetAttrString and PyEval_CallObject do.

For an example on how to do this, see "Extending and Embedding the Python  
Interpreter" <http://docs.python.org/ext/intro.html> specially section 1.2

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to