Does This Scare You?

Random832 random832 at fastmail.com
Mon Aug 22 08:56:50 EDT 2016


On Mon, Aug 22, 2016, at 08:39, Chris Angelico wrote:
> Nope. On Windows, you would try/except it.

No, you can't, because the failure mode often isn't "file refuses to
open" but "data is written to a serial port".
 There are myriad other ways
> something could fail, and the only correct action is to attempt it.
> Most of the reserved names will simply give an error; the only way
> you'd actually get incorrect behaviour is if the file name, including
> extension, is exactly a device name.

I think the reason you believe this can be traced back to the
"C:\con\con" trick, which crashed the system by trying to use the name
as a directory.
> (Caveat: My knowledge of Windows
> is rusty and my testing just now was cursory. I could be wrong.)

Eryk Sun already posted an example using "NUL .txt".


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /