← Back to context

Comment by antonvs

13 hours ago

It’s a Windows problem. There’s still, to this day, a 259-character limit on path length in the Win32 API unless the OS has been configured to support long paths and the application uses the correct subset of Windows APIs. For example if you use ‘CreateFileA’, you’re stuck with the limit no matter what.

There’s no problem with Python in general. The registry value LongPathsEnabled, which is probably the one you were asked to set, affects the entire Windows system.

However, there’s also an older workaround that allows programs to use “extended paths” even if that setting is off, by prefixing path strings with “\\?\”. So applications using that workaround can use long paths no matter how Windows is configured. But Python doesn’t use the workaround, it uses the modern APIs and if you want long paths, you need to configure the underlying Windows system to enable it.

Thanks for the explanation! This is indeed consistent with my observations.

But it brings me to two follow-up questions:

1) What is that registry switch even doing, if the problem can be solved with just setting it?

2) Why is Python not using the workaround like ~everyone else?