AUX File Writing Error

John Machin sjmachin at lexicon.net
Thu Feb 15 01:34:59 EST 2007


On Feb 15, 4:03 pm, thewritersc... at gmail.com wrote:
> Hi guys!
>
> I'm new to python so please be aware that I'm probably missing the
> obvious. Here's my problem...
>
> >>> t = "AUX"
> >>> f = open('c:\\' + t + '.csv', 'a')
>
> Traceback (most recent call last):
>   File "<pyshell#37>", line 1, in <module>
>     f = open('c:\\' + t + '.csv', 'a')
> IOError: [Errno 2] No such file or directory: 'c:\\AUX.csv'
>
> >>> t = "A"
> >>> f = open('c:\\' + t + '.csv', 'a')
>
> As you can see python has no problem opening a file when t = "A", but
> not when it is "AUX" (no "A.csv" or "AUX.csv" exists on the C:\ folder
> prior to when these are run).
>
> Is there any way I can create an "AUX.csv" file without the error?

Probably not. AUX, CON, NUL, PRN, LPT, COM1, COM2 etc (with or without
an extension) are reserved in Windows for specific devices for
compatibility with MS-DOS 1.00 programs, which did that for
compatibility with CP/M.

HTH,
John




More information about the Python-list mailing list