Title: Compatibility issue between argparse and pythonnet packages · Issue #404 · pythonnet/pythonnet · GitHub
Open Graph Title: Compatibility issue between argparse and pythonnet packages · Issue #404 · pythonnet/pythonnet
X Title: Compatibility issue between argparse and pythonnet packages · Issue #404 · pythonnet/pythonnet
Description: Environment Pythonnet version: 2.3.0.dev1 (built from master on 23/02/2017) Python version: 2.7.13 64bit Operating System: Windows 7 64bit Details I tested the pythonnet version from yesterday, 23/02/2017, as we are interested in the bug...
Open Graph Description: Environment Pythonnet version: 2.3.0.dev1 (built from master on 23/02/2017) Python version: 2.7.13 64bit Operating System: Windows 7 64bit Details I tested the pythonnet version from yesterday, 23/...
X Description: Environment Pythonnet version: 2.3.0.dev1 (built from master on 23/02/2017) Python version: 2.7.13 64bit Operating System: Windows 7 64bit Details I tested the pythonnet version from yesterday, 23/...
Opengraph URL: https://github.com/pythonnet/pythonnet/issues/404
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Compatibility issue between argparse and pythonnet packages","articleBody":"### Environment\r\n\r\n- Pythonnet version: 2.3.0.dev1 (built from master on 23/02/2017)\r\n- Python version: 2.7.13 64bit\r\n- Operating System: Windows 7 64bit\r\n\r\n### Details\r\n\r\n- I tested the pythonnet version from yesterday, 23/02/2017, as we are interested in the bug fix for the method overload issue #377. I noticed that we are now running into compatibility issues with the package argparse.\r\n\r\nThe package argparse now only works correctly, if the parsing of the command line arguments is done BEFORE the import statement of pythonnet (import clr).\r\n\r\nIf I revert my pythonnet version to pythonnet==2.2.2, then the problem disappears.\r\n\r\nThe following minimal test code illustrates the problem:\r\n```\r\nfile: test.py\r\nimport argparse\r\n# import clr # can't put it here, args.arg1 will be None\r\n\r\nparser = argparse.ArgumentParser()\r\nparser.add_argument('--arg1', '-a', help='argument 1', dest='arg1')\r\nargs = parser.parse_args()\r\n\r\nimport clr \r\nprint('Argument 1 = ')\r\nprint(args.arg1)\r\n```\r\nThen I start the script from command line as\r\n\u003e python test.py --arg1 \"Hello World\"\r\n```\r\nIf I run the code with the \"import clr\" statement after the call to parser.parse_args() then I get the desired output: \r\nArgument 1 =\r\nhello world\r\n\r\nHowever, if I put the \"import clr\" at the beginning of the file, I get the output:\r\nArgument 1 =\r\nNone\r\n","author":{"url":"https://github.com/sg08013","@type":"Person","name":"sg08013"},"datePublished":"2017-02-24T07:51:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":13},"url":"https://github.com/404/pythonnet/issues/404"}
| 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:30bc95be-95f5-124f-2518-6c7b7ebe5996 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 90B4:22E260:2114812:2C7C556:6970341E |
| html-safe-nonce | 3d99eb610b8641a5c82cd28a01ea7ee16f47155b0d36a6f812cbdd915401af4e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MEI0OjIyRTI2MDoyMTE0ODEyOjJDN0M1NTY6Njk3MDM0MUUiLCJ2aXNpdG9yX2lkIjoiNDYxMTExMTQ1NjY1MTM1OTI2MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 96fb61eff9528bf64519e5c87fa7103fcab31c775a739d302248e8ab1accb154 |
| hovercard-subject-tag | issue:209981499 |
| 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/404/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3106339930a781f1b034f6d503218e19da153cdf81c4e7252e0b3c5dc4fb6b54/pythonnet/pythonnet/issues/404 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3106339930a781f1b034f6d503218e19da153cdf81c4e7252e0b3c5dc4fb6b54/pythonnet/pythonnet/issues/404 |
| og:image:alt | Environment Pythonnet version: 2.3.0.dev1 (built from master on 23/02/2017) Python version: 2.7.13 64bit Operating System: Windows 7 64bit Details I tested the pythonnet version from yesterday, 23/... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sg08013 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2 |
| 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 | f643964067a552f02067066d6a910b2f90a5721f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width