Skip to content

PathRI behavior incorrect/not helpful on Windows #7186

@mih

Description

@mih

Demo:

>>> pathlib.PureWindowsPath("C:\\Windows").as_uri()
'file:///C:/Windows'

>>> RI("file:///c:/Windows").localpath
'/c:/Windows'

>>> pathlib.PureWindowsPath('/c:/Windows')
PureWindowsPath('/c:/Windows')

Ergo, it get's transformed into an unusable string.

A better approach would be:

>>> nturl2path.url2pathname(urlparse("file:///c:/Windows").path)
'C:\\Windows'

nturl2path.url2pathname is called by urllib.request.url2pathname on windows.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions