New submission from Holly <hollyrobert...@gmail.com>:

If we use os.mkdir to create a folder as follows:
    os.mkdir("C:/test /")
Then we successfully create a folder with name "test ". This folder can be 
accessed normally, but it cannot be renamed or deleted. Instead we get the 
following error message:
    Could not find this item
    This is no longer located in C:\. Verify the item's location and try again.
I used Python 3.7.3 (64 bit) and Windows 1809

Obviously this is down to how windows doesn't handle paths particularly nicely, 
so it's not really python's fault. However even if it's decided that python 
shouldn't handle this then it would be better for an exception to be thrown 
rather than creating a corrupt folder.

Note: We can delete the folder by using the Long UNC path, eg. rd "\\?\C:\test "

----------
components: IO
messages: 347346
nosy: hollyroberts
priority: normal
severity: normal
status: open
title: os.mkdir creates invalid folder when path string has trailing space and 
slash
type: behavior
versions: Python 3.7

_______________________________________
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