Title: how to execute within Entrance "if __name__ == "__main__":" · Issue #1495 · pythonnet/pythonnet · GitHub
Open Graph Title: how to execute within Entrance "if __name__ == "__main__":" · Issue #1495 · pythonnet/pythonnet
X Title: how to execute within Entrance "if __name__ == "__main__":" · Issue #1495 · pythonnet/pythonnet
Description: Here is a simple python file and I would like to try to execute it like main file in my .Net application. But I didn't find a way. Is there any way to do this? thx a lot `import sys import clr def func1(): print('func1') def func2(a, b):...
Open Graph Description: Here is a simple python file and I would like to try to execute it like main file in my .Net application. But I didn't find a way. Is there any way to do this? thx a lot `import sys import clr def ...
X Description: Here is a simple python file and I would like to try to execute it like main file in my .Net application. But I didn't find a way. Is there any way to do this? thx a lot `import sys import clr ...
Opengraph URL: https://github.com/pythonnet/pythonnet/issues/1495
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"how to execute within Entrance \"if __name__ == \"__main__\":\"","articleBody":"Here is a simple python file and I would like to try to execute it like main file in my .Net application. But I didn't find a way. Is there any way to do this? thx a lot\r\n`import sys\r\nimport clr\r\n\r\n\r\ndef func1():\r\n print('func1')\r\n\r\n\r\ndef func2(a, b):\r\n print(a+b)\r\n print('func2')\r\n return a+b\r\n\r\n\r\nif __name__ == \"__main__\":\r\n print(func2(1,2))\r\n sys.exit(0)\r\n`","author":{"url":"https://github.com/NiKeYiGuN","@type":"Person","name":"NiKeYiGuN"},"datePublished":"2021-07-28T06:59:49.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1495/pythonnet/issues/1495"}
| 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:644bf089-c476-a629-ce80-a79364427e87 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CCE2:DB76B:9A41DF:CAFA71:69716BE1 |
| html-safe-nonce | efd79d32a052831001ebacc7511b6d3e7b69b260d428cdae3fa53ad628570143 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQ0UyOkRCNzZCOjlBNDFERjpDQUZBNzE6Njk3MTZCRTEiLCJ2aXNpdG9yX2lkIjoiMjg2MTYxMDk5MzEwNjExOTY1MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 92e165901b9777cffa69addc2bdf48ad1f10e68d34d0d6aa1e36e2c5d42692bd |
| hovercard-subject-tag | issue:954542091 |
| 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/1495/issue_layout |
| twitter:image | https://opengraph.githubassets.com/78e38df03c3546525f2fb1044b4adf3ca8bee2c8d5dc6660fabf1609406f291b/pythonnet/pythonnet/issues/1495 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/78e38df03c3546525f2fb1044b4adf3ca8bee2c8d5dc6660fabf1609406f291b/pythonnet/pythonnet/issues/1495 |
| og:image:alt | Here is a simple python file and I would like to try to execute it like main file in my .Net application. But I didn't find a way. Is there any way to do this? thx a lot `import sys import clr def ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | NiKeYiGuN |
| hostname | github.com |
| expected-hostname | github.com |
| None | 353479110ec1e87d687013548f216c852055ec907d09d2fb6a180cb5ed9d28e1 |
| 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 | a4c7e274c03a115b82dcef6c47ce3f7f903e88e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width