Issue 23039: File name restriction on Windows (original) (raw)

Issue23039

Created on 2014-12-12 15:33 by iMath, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg232555 - (view) Author: Philip Lee (iMath) Date: 2014-12-12 15:33
when using open(filename, 'w') on Windows , File names are not allowed to contain any characters in \/:*?"<>| , however open(filename, 'w') doesn't throw any exceptions when the file name contains these characters . I think some warning should be written in the documentation or exceptions thrown should happen when the file name contains these characters .
msg232557 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-12-12 16:20
The argument to open is a path. Some of those characters have a meaning in a path. I ran a couple of quick experiments: "ab*c.txt" fails with an exception. ":16.txt" created a file, which I can do an 'ls' and cat (but not rm) on in git-bash, but I'm not sure where it actually is in the file system. Open is just calling the OS to do the open, so if no error is raised, the *OS* (Windows) is not raising the error. I don't think there is a bug here, unless it is in Windows itself.
msg232559 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2014-12-12 16:29
Agree with RDM: we're just passing the path through to the Windows API (on Windows). We don't generally carry out this kind of pre-emptive check.
History
Date User Action Args
2022-04-11 14:58:11 admin set github: 67228
2014-12-12 16:29:18 tim.golden set status: open -> closedresolution: not a bugmessages: + stage: resolved
2014-12-12 16:20:10 r.david.murray set nosy: + tim.golden, steve.dower, r.david.murray, zach.waremessages: + components: + Windows
2014-12-12 15:33:43 iMath create