# Bug report ### Bug description: On Windows, `urllib.request.pathname2url()` raises `OSError` when given a path with a colon in any position other than the second character. This excludes paths with [NTFS alternate data streams](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/c54dec26-1551-4d3a-a0ea-4fa40f848eb3), which are valid in other path-processing functions (e.g. in `os.path` and `pathlib`): ```python >>> from urllib.request import pathname2url >>> pathname2url(r'C:\foo:bar') OSError: Bad path: C:/foo:bar # expected: ///C:/foo%3Abar >>> pathname2url(r'foo:bar') OSError: Bad path: foo:bar # expected: foo%3Abar ``` ### CPython versions tested on: CPython main branch ### Operating systems tested on: Windows <!-- gh-linked-prs --> ### Linked PRs * gh-126760 <!-- /gh-linked-prs -->