Title: pywin32 pth files create nested search paths and prevent imports of modules by some names · Issue #1360 · microsoft/python-language-server · GitHub
Open Graph Title: pywin32 pth files create nested search paths and prevent imports of modules by some names · Issue #1360 · microsoft/python-language-server
X Title: pywin32 pth files create nested search paths and prevent imports of modules by some names · Issue #1360 · microsoft/python-language-server
Description: Install pywin32 from PyPI and then try to do: import win32api Which fails. The language server prints: [Info - 2:29:32 PM] Interpreter search paths: [Info - 2:29:32 PM] c:\python37\dlls [Info - 2:29:32 PM] c:\python37\lib [Info - 2:29:32...
Open Graph Description: Install pywin32 from PyPI and then try to do: import win32api Which fails. The language server prints: [Info - 2:29:32 PM] Interpreter search paths: [Info - 2:29:32 PM] c:\python37\dlls [Info - 2:2...
X Description: Install pywin32 from PyPI and then try to do: import win32api Which fails. The language server prints: [Info - 2:29:32 PM] Interpreter search paths: [Info - 2:29:32 PM] c:\python37\dlls [Info - 2:2...
Opengraph URL: https://github.com/microsoft/python-language-server/issues/1360
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"pywin32 pth files create nested search paths and prevent imports of modules by some names","articleBody":"Install `pywin32` from PyPI and then try to do:\r\n\r\n```python\r\nimport win32api\r\n```\r\n\r\nWhich fails. The language server prints:\r\n\r\n```\r\n[Info - 2:29:32 PM] Interpreter search paths:\r\n[Info - 2:29:32 PM] c:\\python37\\dlls\r\n[Info - 2:29:32 PM] c:\\python37\\lib\r\n[Info - 2:29:32 PM] c:\\python37\r\n[Info - 2:29:32 PM] c:\\users\\jabaile\\test_projects\\win32thing\\venv\r\n[Info - 2:29:32 PM] c:\\users\\jabaile\\test_projects\\win32thing\\venv\\lib\\site-packages\r\n[Info - 2:29:32 PM] c:\\users\\jabaile\\test_projects\\win32thing\\venv\\lib\\site-packages\\win32\r\n[Info - 2:29:32 PM] c:\\users\\jabaile\\test_projects\\win32thing\\venv\\lib\\site-packages\\win32\\lib\r\n[Info - 2:29:32 PM] c:\\users\\jabaile\\test_projects\\win32thing\\venv\\lib\\site-packages\\pythonwin\r\n```\r\n\r\nNote that `win32` is in `site-packages` and `lib` is inside of `win32`.\r\n\r\nThis package ships multiple modules, and uses a `pth` file to add those search paths:\r\n\r\n```\r\n# .pth file for the PyWin32 extensions\r\nwin32\r\nwin32\\lib\r\nPythonwin\r\n```\r\n\r\nThe module `win32api` is located in the `win32` directory. However, due to the ordering of the paths (`site-packages` comes first), we end up in a scenario where only this works:\r\n\r\n```python\r\nimport win32.win32api\r\n# or equivalently to the original example\r\nfrom win32 import win32api\r\n```\r\n\r\nBecause we've already \"carved\" out `site-packages`, and any module below it must be fully specified, even though a later search path allows the module to have a second name.\r\n\r\nThis is a concrete example of similar issues we have with extraPaths on user code, but due to the use of `pth` files here to add search paths, this breaks out into library code.","author":{"url":"https://github.com/jakebailey","@type":"Person","name":"jakebailey"},"datePublished":"2019-07-22T21:43:49Z","url":"https://github.com/microsoft/python-language-server/issues/1360"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:5681c7e0-1ee0-18d1-0c72-28e152cb7602 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B00:729DB:17391C:1E39F4:6AFE57E6 |
| html-safe-nonce | d94fb6e02cd96e45b5bb35c9386f89925d326ccdd15e265b3c32d2769af70648 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjAwOjcyOURCOjE3MzkxQzoxRTM5RjQ6NkFGRTU3RTYiLCJ2aXNpdG9yX2lkIjoiNjI2NjgzNzk3MDgwODg4NzI3MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7324628fb844c5dee84c979b4f3c81953ec89a6b0f79df652054e5cf054b2025 |
| hovercard-subject-tag | issue:471352229 |
| 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/microsoft/python-language-server/1360/issue_layout |
| twitter:image | https://opengraph.githubassets.com/95e0fda4a8b86e9d15b934cb68cb59a9174b6b62cf9bbd8d8721feee86c9c627/microsoft/python-language-server/issues/1360 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/95e0fda4a8b86e9d15b934cb68cb59a9174b6b62cf9bbd8d8721feee86c9c627/microsoft/python-language-server/issues/1360 |
| og:image:alt | Install pywin32 from PyPI and then try to do: import win32api Which fails. The language server prints: [Info - 2:29:32 PM] Interpreter search paths: [Info - 2:29:32 PM] c:\python37\dlls [Info - 2:2... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jakebailey |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/python-language-server git https://github.com/microsoft/python-language-server.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 145901977 |
| octolytics-dimension-repository_nwo | microsoft/python-language-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 145901977 |
| octolytics-dimension-repository_network_root_nwo | microsoft/python-language-server |
| 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 | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width