Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Setup Disabling Path Length Limit Pros and Cons?

I recently installed Python 3.7 and at the end of the setup, there is the option to "Disable path length limit". I don't know whether or not I should do this.

What are the pros and cons of doing this? Just from the sound of it you should always disable it.

like image 827
Qwerty Qwerts Avatar asked Aug 01 '18 02:08

Qwerty Qwerts


People also ask

Should I disable path length limit installing Python?

Python will work fine even the path length is disabled. Disabling the path length is better than shortening the path or the file name. Because if someone installed the Python in a directory more than a recommended length means it will cause the error. So using this option is much better.

What is disable Windows path length limit?

In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters. A local path is structured in the following order: drive letter, colon, backslash, name components separated by backslashes, and a terminating null character.

What is Python path limit?

Removing the MAX_PATH Limitation. Windows historically has limited path lengths to 260 characters. This meant that paths longer than this would not resolve and errors would result. In the latest versions of Windows, this limitation can be expanded to approximately 32,000 characters.

Why is there a path length limit?

The 260-character path limit is due to fixed buffers in the runtime library for DOS/Windows path processing (e.g. ANSI <=> Unicode, working directory, and DOS<=>NT path conversion).


1 Answers

I recommend selecting that option and thereby removing the path length limit. It will potentially save you time in future on debugging an avoidable issue.

Here is an anecdote of how I came to know about it:

During the compilation of my program (C# code on a Windows machine), I started getting the following error:

error MSB3541: Files has invalid value "long\path\filename". The specified path,   file name, or both are too long. The fully qualified file name must be less than   260 characters, and the directory name must be less than 248 characters. 

This error was not allowing me to build my project and the only apparent solution to this issue was to shorten my path/file names. Turns out that this bug is a built-in limitation in NTFS (Window's File System): Why does the 260 character path length limit exist in Windows?

After a couple of decades with the limitation built into the NTFS file system, it has finally been fixed (Unix based system did not have it) in Windows 10 (https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#maximum-path-length-limitation), but it is not enabled automatically, and needs registry (or group policy) settings to do this. The Python option allows you to disable it for Python libraries, saving you a lot of headache.

Do note that enabling this option will,

a) break compatibility of your programs on systems using older versions of Windows 10 and lower, when using long file/directory names and paths.

b) break programs on Windows 10 machines not having this option enabled, when using long file/directory names and paths.

like image 109
khan Avatar answered Oct 09 '22 04:10

khan