[Tutor] Why does os.path.realpath('test_main.py') give different results for unittest than for testing statement in interpreter?
Albert-Jan Roskam
sjeik_appie at hotmail.com
Tue Jan 9 09:48:16 EST 2018
From: Tutor <tutor-bounces+sjeik_appie=hotmail.com at python.org> on behalf of Steven D'Aprano <steve at pearwood.info>
Sent: Tuesday, January 9, 2018 8:47 AM
To: tutor at python.org
Subject: Re: [Tutor] Why does os.path.realpath('test_main.py') give different results for unittest than for testing statement in interpreter?
<snip>
> The Python 3.5 source code for os.path.realpath under Windows looks like
> this:
>
># realpath is a no-op on systems without islink support
> realpath = abspath
Déjà-vu [1], but I think that it would be a great enhancement if os.realpath would return the UNC path if given a mapped drive in Windows, if needed as extended path (prefixed with "\\?\UNC\"). That's something I use all the time, unlike symlinks, in Windows.
And I would also welcome a convenience function in the os.path module that does expanduser, expandvars, normpath, realpath, and maybe more.
I haven't used pathlib yet. Will os.path development some day be frozen so pathlib becomes the standard? It seems to be nicer.
[1] http://python.6.x6.nabble.com/Tutor-getUncPath-mappedDrive-td4652304.html
More information about the Tutor
mailing list