Title: OSError when try convert URI to pathlib.Path · Issue #91504 · python/cpython · GitHub
Open Graph Title: OSError when try convert URI to pathlib.Path · Issue #91504 · python/cpython
X Title: OSError when try convert URI to pathlib.Path · Issue #91504 · python/cpython
Description: When try to convert URI to pathlib.Path I get an error: E:\Work\Venvs\p39\Scripts\python.exe "E:/uri_test/pathlib_test.py" D:\Tests\samples\images\3.bmp exists=True file:///D:/Tests/samples/images/3.bmp Traceback (most recent call last):...
Open Graph Description: When try to convert URI to pathlib.Path I get an error: E:\Work\Venvs\p39\Scripts\python.exe "E:/uri_test/pathlib_test.py" D:\Tests\samples\images\3.bmp exists=True file:///D:/Tests/samples/images/...
X Description: When try to convert URI to pathlib.Path I get an error: E:\Work\Venvs\p39\Scripts\python.exe "E:/uri_test/pathlib_test.py" D:\Tests\samples\images\3.bmp exists=True file:///D:/Tests/sampl...
Opengraph URL: https://github.com/python/cpython/issues/91504
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"OSError when try convert URI to pathlib.Path","articleBody":"When try to convert URI to pathlib.Path I get an error:\r\n\r\n```pytb\r\nE:\\Work\\Venvs\\p39\\Scripts\\python.exe \"E:/uri_test/pathlib_test.py\"\r\nD:\\Tests\\samples\\images\\3.bmp exists=True\r\nfile:///D:/Tests/samples/images/3.bmp\r\nTraceback (most recent call last):\r\n File \"E:\\uri_test\\pathlib_test.py\", line 9, in \u003cmodule\u003e\r\n from_uri_path = Path(uri_path).resolve()\r\n File \"C:\\pythons\\Python39\\lib\\pathlib.py\", line 1215, in resolve\r\n s = self._flavour.resolve(self, strict=strict)\r\n File \"C:\\pythons\\Python39\\lib\\pathlib.py\", line 215, in resolve\r\n s = self._ext_to_normal(_getfinalpathname(s))\r\nOSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'file:\\\\D:\\\\Tests\\\\samples\\\\images\\\\3.bmp'\r\n```\r\n\r\nCode to reproduce:\r\n```python\r\nfrom pathlib import Path\r\n\r\nimg_path = Path(r\"D:\\Tests\\samples\\images\\3.bmp\").resolve()\r\nprint(f\"{img_path} exists={img_path.exists()}\")\r\n\r\nuri_path = img_path.as_uri()\r\nprint(uri_path)\r\n\r\nfrom_uri_path = Path(uri_path).resolve()\r\nprint(f\"{from_uri_path} exists={from_uri_path.exists()}\")\r\n```\r\n\r\nPython version: 3.9\r\n\r\nWith 3.10 works.","author":{"url":"https://github.com/bw7715","@type":"Person","name":"bw7715"},"datePublished":"2022-04-13T12:13:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":18},"url":"https://github.com/91504/cpython/issues/91504"}
| 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:ac1da544-ebe2-7189-3c1d-f09eab178fe3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8712:96E3C:20802D7:2D481A2:69693740 |
| html-safe-nonce | 8985a5767797d4f5d048e6640b962d8e3d8ee0e53d52e4c410886a9abd894a51 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NzEyOjk2RTNDOjIwODAyRDc6MkQ0ODFBMjo2OTY5Mzc0MCIsInZpc2l0b3JfaWQiOiI3NTAxNzQ1NjE2NDc2MjU2MDY0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | de2d94221cf1dc632d332e1762cb8ee8e24657a3004004d261ac36615fa74396 |
| hovercard-subject-tag | issue:1203217586 |
| 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/python/cpython/91504/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4f691d17e8cd8503cd7c71689a87b050acb8b8018485b9db42a0813332f12486/python/cpython/issues/91504 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4f691d17e8cd8503cd7c71689a87b050acb8b8018485b9db42a0813332f12486/python/cpython/issues/91504 |
| og:image:alt | When try to convert URI to pathlib.Path I get an error: E:\Work\Venvs\p39\Scripts\python.exe "E:/uri_test/pathlib_test.py" D:\Tests\samples\images\3.bmp exists=True file:///D:/Tests/samples/images/... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bw7715 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 54182691a21263b584d2e600b758e081b0ff1d10ffc0d2eefa51cf754b43b51d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | d69ac0477df0f87da03b8b06cebd187012d7a930 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width