Title: Import does not work from Cython · Issue #1890 · pythonnet/pythonnet · GitHub
Open Graph Title: Import does not work from Cython · Issue #1890 · pythonnet/pythonnet
X Title: Import does not work from Cython · Issue #1890 · pythonnet/pythonnet
Description: This code works from Python: import clr clr.AddReference("abc.dll") from ABC import abc But when compiled with Cython --embed, it fails: cython test.py --embed call vcvarsallbat x64 cl test.c /I C:\Python38\include /link C:\Python38\libs...
Open Graph Description: This code works from Python: import clr clr.AddReference("abc.dll") from ABC import abc But when compiled with Cython --embed, it fails: cython test.py --embed call vcvarsallbat x64 cl test.c /I C:...
X Description: This code works from Python: import clr clr.AddReference("abc.dll") from ABC import abc But when compiled with Cython --embed, it fails: cython test.py --embed call vcvarsallbat x64 cl te...
Opengraph URL: https://github.com/pythonnet/pythonnet/issues/1890
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Import does not work from Cython","articleBody":"This code works from Python:\r\n\r\n```\r\nimport clr\r\nclr.AddReference(\"abc.dll\")\r\nfrom ABC import abc\r\n```\r\n\r\nBut when compiled with Cython `--embed`, it fails:\r\n\r\n```\r\ncython test.py --embed\r\ncall vcvarsallbat x64\r\ncl test.c /I C:\\Python38\\include /link C:\\Python38\\libs\\python38.lib\r\ntest.exe\r\n```\r\n\r\nwith:\r\n\r\n\u003e Traceback (most recent call last): \r\n\u003e File \"test.py\", line 3, in init test \r\n\u003e ModuleNotFoundError: No module named 'ABC'\r\n\r\nIs this related to https://github.com/pythonnet/pythonnet/issues/941?\r\n\r\nIs there a temporary or permanent fix for this? \r\nThanks!\r\n\r\nA good idea would be to have an import function that can be called on `clr` namespace:\r\n\r\n```\r\nimport clr\r\nclr.AddReference(\"abc.dll\")\r\nABC = clr.ImportModule('ABC')\r\n```\r\n\r\nthat would not need to use the overridden `import` built-in function.","author":{"url":"https://github.com/josephernest","@type":"Person","name":"josephernest"},"datePublished":"2022-07-27T05:09:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/1890/pythonnet/issues/1890"}
| 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:24095ed1-2b79-9fe7-6a54-53328cf345d7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 95C4:29F96C:2DDA10:3D1414:69715313 |
| html-safe-nonce | 247d94e456aeb7a5a799e62ca6c42c0f91bfc7320580b8b778eab3430012ae61 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NUM0OjI5Rjk2QzoyRERBMTA6M0QxNDE0OjY5NzE1MzEzIiwidmlzaXRvcl9pZCI6IjczOTg4NjkxNDk1OTg5NjI0NTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4aa5577024d622966c854884629d597c436f03deaeab1c8a1946a2377a9fdb98 |
| hovercard-subject-tag | issue:1319029169 |
| 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/1890/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6eae02c6dc5bed29024340c106f8dfee5ce39664a85a9bd7f24a4ecbae3d3600/pythonnet/pythonnet/issues/1890 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6eae02c6dc5bed29024340c106f8dfee5ce39664a85a9bd7f24a4ecbae3d3600/pythonnet/pythonnet/issues/1890 |
| og:image:alt | This code works from Python: import clr clr.AddReference("abc.dll") from ABC import abc But when compiled with Cython --embed, it fails: cython test.py --embed call vcvarsallbat x64 cl test.c /I C:... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | josephernest |
| hostname | github.com |
| expected-hostname | github.com |
| None | fd5876ec68f4a61d42f4010f6d1b2764d8ae314777de44028a7708a1d7bac1b5 |
| 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 | 8f48ed2345879fb640360c3a24f1d1780c3ed3cb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width