Title: PythonException.Format() throws another PythonException. · Issue #1190 · pythonnet/pythonnet · GitHub
Open Graph Title: PythonException.Format() throws another PythonException. · Issue #1190 · pythonnet/pythonnet
X Title: PythonException.Format() throws another PythonException. · Issue #1190 · pythonnet/pythonnet
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()) { var script = "a=b\n"; try { PythonEng...
Open Graph 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())...
X 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())...
Opengraph URL: https://github.com/pythonnet/pythonnet/issues/1190
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PythonException.Format() throws another PythonException.","articleBody":"### Environment\r\n\r\n- Pythonnet version: V2.5.1.\r\n- Python version: V3.8.4 64 bit\r\n- Operating System: Windows 10 64 bit\r\n\r\n### Details\r\n1. Run the following code in a console application with Visual Studio.\r\n\r\n```csharp\r\nusing (Py.GIL())\r\n{\r\n\r\n var script = \"a=b\\n\";\r\n try\r\n {\r\n PythonEngine.Exec(script);\r\n }\r\n catch (PythonException ex)\r\n {\r\n try\r\n {\r\n var m = ex.Format();\r\n }\r\n catch (Exception exception)\r\n {\r\n var t = exception.GetType();\r\n var s = exception.Message;\r\n }\r\n }\r\n}\r\n```\r\n\r\nSince \"a=b\" is invalid, I expected an error message like so returned by `ex.Format()`:\r\n\r\n```\r\nTraceback (most recent call last):\r\n File \"\u003cstring\u003e\", line 1, in \u003cmodule\u003e\r\nNameError: name 'b' is not defined\r\n```\r\n\r\nHowever, 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, in __init__\\n if (exc_value and exc_value.__cause__ is not None\\n'] .\r\n\r\n","author":{"url":"https://github.com/tetsushmz","@type":"Person","name":"tetsushmz"},"datePublished":"2020-07-25T15:29:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1190/pythonnet/issues/1190"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c19e1ef9-705f-3712-0a8b-099c7373ed84 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA52:202F53:24D04D8:32B2C70:6973AA5D |
| html-safe-nonce | d950b7ac00bade8515018c932fd971a51e7a4d0db87236ffcd0134e8ee07e9ed |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTUyOjIwMkY1MzoyNEQwNEQ4OjMyQjJDNzA6Njk3M0FBNUQiLCJ2aXNpdG9yX2lkIjoiNDQ1NDAzMjM2MDc2NDMyMDM0OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5681ac6db4cf9457ffdc343e357dc92493973b58ee6769e00c6c3173d70a9152 |
| hovercard-subject-tag | issue:665604642 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pythonnet/pythonnet/1190/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2e700e5a7b5a07ce890c44db655ad6da40d935707b1e715efbdaea0723bea087/pythonnet/pythonnet/issues/1190 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2e700e5a7b5a07ce890c44db655ad6da40d935707b1e715efbdaea0723bea087/pythonnet/pythonnet/issues/1190 |
| og:image:alt | 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())... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tetsushmz |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3e9aa9d0c22a21b13b378b4acd09f5dd4876a884425aacd32a9f473b84c8762d |
| turbo-cache-control | no-preview |
| go-import | github.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git |
| octolytics-dimension-user_id | 6050430 |
| octolytics-dimension-user_login | pythonnet |
| octolytics-dimension-repository_id | 14748123 |
| octolytics-dimension-repository_nwo | pythonnet/pythonnet |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14748123 |
| octolytics-dimension-repository_network_root_nwo | pythonnet/pythonnet |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9240c0b5247c88bacc8dffb46ecac04c94fd094b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width