Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

> it would be better for an exception to be thrown rather than creating a 
> corrupt folder.

I am not convinced that Python should refuse to create a perfectly valid 
directory because some components of Windows sometimes have trouble resolving 
the pathname under some circumstances.

Microsoft say:

"Do not end a file or directory name with a space or a period. Although the 
underlying file system may support such names, the Windows shell and user 
interface does not."

https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming_conventions

but Python is talking to the file system, not the shell or Windows Explorer.

This is a common problem, with numerous solutions:

https://superuser.com/questions/198256/how-to-delete-a-folder-containing-trailing-spaces

It's apparently quite common in shared environments where (for example) Mac 
users may copy files ending with a space onto Windows drives.

----------
components: +Windows
nosy: +paul.moore, steve.dower, steven.daprano, tim.golden, zach.ware

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37506>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to