homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: os.path.abspath(os.devnull) returns \\\\nul should be nul?
Type: behavior Stage: test needed
Components: Windows Versions: Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: abakker, amaury.forgeotdarc, ezio.melotti, georg.brandl, jaraco, l0nwlf, orsenthil
Priority: normal Keywords: easy, patch

Created on 2010年02月11日 15:09 by abakker, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue7909-test.patch jaraco, 2010年03月03日 02:45
Messages (7)
msg99212 - (view) Author: Arno Bakker (abakker) Date: 2010年02月11日 15:09
I encountered this when somebody used:
logging.basicConfig(level=logging.CRITICAL,
 format='%(asctime)s %(levelname)-8s %(message)s',
 datefmt='%a, %d %b %Y %H:%M:%S',
 filename=os.devnull,
 filemode='w')
the logging code apparently calls os.path.abspath(filename) somewhere,
causing an exception:
 File "c:\python264\lib\logging\__init__.py", line 838, in _open
 stream = open(self.baseFilename, self.mode)
 IOError: [Errno 2] No such file or directory: '\\\\nul'
msg99275 - (view) Author: Shashwat Anand (l0nwlf) Date: 2010年02月12日 17:44
Seems fine to me, does not raise any errors. My OS is OS X Snow Leopard. I checked it in python 2.5, 2.6, 2.7 too, no issues raised.
Shashwat-Anands-MacBook-Pro:test l0nwlf$ python2.6
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os,logging
>>> logging.basicConfig(level=logging.CRITICAL,
... format='%(asctime)s %(levelname)-8s %(message)s',
... datefmt='%a, %d %b %Y %H:%M:%S',
... filename=os.devnull,
... filemode='w')
>>>
msg99276 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010年02月12日 17:47
From the bug report, it look likes its specific to windows, not OS X.
msg99278 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010年02月12日 18:11
nul is a special "dos device"
_getfullpathname() correctly returns \\.\nul, but normpath() then simplifies it to \\nul
I suggest that normpath() be changed to consider \\.\ as a special prefix, and keep it intact when it appears at the start of the path. See also
http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx 
msg100319 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2010年03月03日 00:38
This bug does not exhibit in Python 3.1.1.
msg100329 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2010年03月03日 02:45
Attaching a test against trunk which elicits the error reported in this bug.
msg112211 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010年07月31日 21:40
Followed Amaury's suggestion in r83368. \\.\ and \\?\ as prefixes now cause normpath() to return the argument as-is.
History
Date User Action Args
2022年04月11日 14:56:57adminsetgithub: 52157
2010年07月31日 21:40:52georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg112211

resolution: fixed
2010年03月03日 02:45:43jaracosetfiles: + issue7909-test.patch
keywords: + patch
messages: + msg100329
2010年03月03日 00:38:48jaracosetnosy: + jaraco

messages: + msg100319
versions: + Python 2.7
2010年02月12日 18:11:36amaury.forgeotdarcsetkeywords: + easy
nosy: + amaury.forgeotdarc
messages: + msg99278

2010年02月12日 17:47:24orsenthilsetnosy: + orsenthil
messages: + msg99276
2010年02月12日 17:44:04l0nwlfsetnosy: + l0nwlf
messages: + msg99275
2010年02月11日 23:41:05ezio.melottisetpriority: normal
nosy: + ezio.melotti

type: behavior
stage: test needed
2010年02月11日 15:09:43abakkercreate

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