- Notifications
You must be signed in to change notification settings - Fork749
Closed
Description
Environment
- Pythonnet version: V2.5.1.
- Python version: V3.8.4 64 bit
- Operating System: Windows 10 64 bit
Details
- Run the following code in a console application with Visual Studio.
using(Py.GIL()){varscript="a=b\n";try{PythonEngine.Exec(script);}catch(PythonExceptionex){try{varm=ex.Format();}catch(Exceptionexception){vart=exception.GetType();vars=exception.Message;}}}
Since "a=b" is invalid, I expected an error message like so returned byex.Format()
:
Traceback (most recent call last): File "<string>", line 1, in <module>NameError: name 'b' is not defined
However, Format() throws another PythonException - "AttributeError : 'str' object has no attribute 'cause'" with the following stack trace - list(TracebackException(\n', ' File "C:\Python38\Lib\traceback.py", line 479, ininit\n if (exc_value and exc_value.cause is not None\n'] .
Metadata
Metadata
Assignees
Labels
No labels