Making safe file names

Chris Angelico rosuav at gmail.com
Tue May 28 09:53:03 EDT 2013


On Tue, May 28, 2013 at 11:44 PM, Albert van der Horst
<albert at spenarnc.xs4all.nl> wrote:
> In article <Lvydneajg7LXNhTMnZ2dnUVZ_rKdnZ2d at westnet.com.au>,
> Neil Hodgson  <nhodgson at iinet.net.au> wrote:
>>    There's also the Windows device name hole. There may be trouble with
>>artists named 'COM4', 'CLOCK$', 'Con', or similar.
>>
>>http://support.microsoft.com/kb/74496
>
> That applies to MS-DOS names. God forbid that this still holds on more modern
> Microsoft operating systems?

Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> open("com1","w").write("Test\n")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'com1'
>>> open("con","w").write("Test\n")
Test
5
>>>

ChrisA



More information about the Python-list mailing list