classification
Title: File name restriction on Windows
Type: enhancement Stage: resolved
Components: IO, Windows Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: iMath, r.david.murray, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2014-12-12 15:33 by iMath, last changed 2014-12-12 16:29 by tim.golden. 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
2014-12-12 16:29:18tim.goldensetstatus: open -> closed
resolution: not a bug
messages: + msg232559

stage: resolved
2014-12-12 16:20:10r.david.murraysetnosy: + tim.golden, steve.dower, r.david.murray, zach.ware
messages: + msg232557
components: + Windows
2014-12-12 15:33:43iMathcreate