We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If I have exception thrown in Python, e.g.
raise LookupError('the message is not passed to CSHARP')
then on .NET side it only shows:
((Python.Runtime.PythonException)$exception).Message "LookupError : " string
The text was updated successfully, but these errors were encountered:
I found the problem in the code: IntPtr has to be converted to PyObject_Str() pointer instead of passing the original pointer to GetManagedString().
IntPtr _pyValueStr = PyObject_Str(_pyValue); string message = Runtime.GetManagedString(_pyValueStr);
https://github.com/pythonnet/pythonnet/blob/master/src/runtime/pythonexception.cs#L38
I found the solution here:
http://stackoverflow.com/a/15907460/2230844
The reason why PyObject_Str() has to be called is because the original pointer is actually a TUPLE, not a string!
Sorry, something went wrong.
No branches or pull requests
If I have exception thrown in Python, e.g.
then on .NET side it only shows:
((Python.Runtime.PythonException)$exception).Message
"LookupError : "
string
The text was updated successfully, but these errors were encountered: