Behaviour of os.path.join
Rhodri James
rhodri at kynesim.co.uk
Wed May 27 11:49:52 EDT 2020
On 27/05/2020 16:12, BlindAnagram wrote:
> I'm sorry that you don't believe me but all I know is how I intend the
> path to be used. And the os.path functions aren't helpful here when
> they actually_change_ the meanings of paths on Windows:
>
>>> fp= "C:\\Documents\finance\\"
>>> abspath(fp)
> 'C:\\Documents\\finance'
>
> If you believe these 'before' and 'after' paths are the same I can only
> assume that you don't work on Windows (where one refers to a directory
> and the other a file without an extension).
More accurately, one is not a legal filename but both are legal
directory names.
I entirely believe that you have a problem, but I'm inclined to think
it's of your own making. You seem to have decided how paths work
without checking whether the language agrees with you. It doesn't, and
hasn't for over a decade without a significant number of complaints (as
in I can't remember the last one, and I've been around here for a while
-- it's too hot for me to want to go hunt in the archives :-).
How are these unexpected extensionless files getting created?
--
Rhodri James *-* Kynesim Ltd
More information about the Python-list
mailing list