New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python for Windows 2.7.7: Path Configuration File No Longer Works With UNC Paths #65871
Comments
I just upgraded from 2.7.6 to 2.7.7, on Windows, and have encountered different behavior in my path configuration (.pth) files. One of my files had lines similar to these: \\host\sharefolder These paths (UNC-style), are not being loaded into sys.path. It is successfully loading path lines from this and other files, so long as they have a drive letter. |
site.addpackage calls site.makepath(sitedir, line): def makepath(*paths):
dir = os.path.join(*paths)
try:
dir = os.path.abspath(dir)
except OSError:
pass
return dir, os.path.normcase(dir) In 2.7.7, os.path.join gets this wrong. For example: >>> print os.path.join(r'C:\Spam\Eggs', r'\\Eggs\Spam')
C:\\Eggs\Spam 3.4 gets it right: >>> print(os.path.join(r'C:\Spam\Eggs', r'\\Eggs\Spam'))
\\Eggs\Spam ntpath.join was reimplemented for bpo-19456. The rewrite depends on ntpath.splitdrive, but 2.x has the old splitdrive that doesn't handle UNC paths: >>> os.path.splitdrive(r'\\Spam\Eggs')
('', '\\\\Spam\\Eggs') Instead there's ntpath.splitunc (deprecated in 3.1+): >>> os.path.splitunc(r'\\Spam\Eggs')
('\\\\Spam\\Eggs', '') Maybe ntpath.join could also try splitunc, or maybe 3.x splitdrive can be backported. 2.7.7 ntpath.join: |
New changeset 26ec6248ee8b by Benjamin Peterson in branch '2.7': |
Changeset 26ec62 regressed Mercurial. http://bz.selenic.com/show_bug.cgi?id=4557 Before: >>> ntpath.join(r'\\foo\bar\baz', '')
'\\\\foo\\bar\\baz\\'
>>> ntpath.join(r'\\foo\bar', '')
'\\\\foo\\bar\\' After: >>> ntpath.join(r'\\foo\bar\baz', '')
'\\\\foo\\bar\\baz\\'
>>> ntpath.join(r'\\foo\bar', '')
'\\\\foo\\bar' |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: