Skip to content

Windows: Long filename detection #13346

Open
@AA-Turner

Description

@AA-Turner

Re: https://discuss.python.org/t/pep-773-a-python-installation-manager-for-windows/77900/160

# Suggest the user to enable Long Paths if path length is
# more than 260
if (
WINDOWS
and error.errno == errno.ENOENT
and error.filename
and len(error.filename) > 260
):
parts.append(
"HINT: This error might have occurred since "
"this system does not have Windows Long Path "
"support enabled. You can find information on "
"how to enable this at "
"https://pip.pypa.io/warnings/enable-long-paths\n"
)

try:
    Path('a' * 300 + '.txt').touch()
except OSError as e:
    exc = e

This gives exc as OSError(22, 'Invalid argument'), where exc.errno == errno.EINVAL, rather than ENOENT.

Python 3.13.2; Windows 11

A

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: error messagesImproving error messagesOS: windowsWindows specificgood first issueA good item for first time contributors to work ontype: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions