[New-bugs-announce] [issue3099] On windows, "import nul" always succeed

Amaury Forgeot d'Arc report at bugs.python.org
Fri Jun 13 03:18:48 CEST 2008


New submission from Amaury Forgeot d'Arc <amauryfa at gmail.com>:

on Windows, the stat() function always returns True for some special
device names (nul, con, com1, lpt1...), even when followed by an extension.

Thus "import con" manages to find that "con.py" exists, and tries to
read from it... fun.

A solution is to use GetFileAttributes() instead.

Note that on python2.5.2, the error message suggest that we have such a
problem, but fortunately the error is still an ImportError::
  >>> import nul
  ImportError: DLL load failed: Le module spécifié est introuvable.

----------
components: Windows
messages: 68115
nosy: amaury.forgeotdarc, ocean-city
severity: normal
status: open
title: On windows, "import nul" always succeed
versions: Python 2.5, Python 2.6, Python 3.0

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3099>
_______________________________________


More information about the New-bugs-announce mailing list