best way to ensure './' is at beginning of sys.path?

eryk sun eryksun at gmail.com
Sun Feb 5 00:26:45 EST 2017


On Sat, Feb 4, 2017 at 3:19 PM, Wildman via Python-list
<python-list at python.org> wrote:
>
> Personally I don't understand the danger in having the dot in the path.  The './' only
> means the current directory.  DOS and Windows has searched the current directory
> since their beginning.  Is that also dangerous?

On Windows Vista and later this can be disabled by defining the
environment variable NoDefaultCurrentDirectoryInExePath. This affects
cmd.exe and CreateProcess, and any program that calls
NeedCurrentDirectoryForExePath [1]. However, it doesn't override
setting "." in PATH, a practice that should be avoided anyway.

[1]: https://msdn.microsoft.com/en-us/library/ms684269



More information about the Python-list mailing list