[issue27616] filedialog.askdirectory inconsistent on Windows between returning "C:/" and "C:/users" (no trailing slash)

Grant Hillebrand report at bugs.python.org
Mon Jul 25 13:37:18 EDT 2016


New submission from Grant Hillebrand:

When running the following code on Windows 7 (64bit os), and selecting a root drive letter, eg C:, it returns "C:/", with a slash appended. When selecting any other path below root level, eg "C:/users" it returns "C:/users" - no slash appended. 
This then introduces an odd edge case in processing the output if the path is to be prepended to directory walk data and other file names.

Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32

>>> from tkinter import filedialog
>>> SourcePath = filedialog.askdirectory()
>>> print(SourcePath)
C:/
>>> SourcePath = filedialog.askdirectory()
>>> print(SourcePath)
C:/NVIDIA
>>>

----------
components: Tkinter, Windows
messages: 271296
nosy: Grant Hillebrand, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: filedialog.askdirectory inconsistent on Windows between returning "C:/" and "C:/users" (no trailing slash)
type: behavior
versions: Python 3.3, Python 3.5

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


More information about the Python-bugs-list mailing list