Issue 8010: tkFileDialog.askopenfiles crashes on Windows 7

Issue8010

Created on 2010-02-24 09:52 by Patrick.Holz, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg100020 - (view) Author: Patrick Holz (Patrick.Holz) Date: 2010-02-24 09:52
When using the function "tkFileDialog.askopenfiles()" on Windows 7 (32-bit) the following error occurs after choosing one or more arbitrary files:

Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkFileDialog
>>> tkFileDialog.askopenfiles()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python26\lib\lib-tk\tkFileDialog.py", line 163, in askopenfiles
    ofiles.append(open(filename, mode))
IOError: [Errno 2] No such file or directory: u'C'

So it seems that the colon after "C" (the drive letter) is wrongly used as a delimiter. The functions "askopenfile" (for a single file to choose) and "askopenfilenames" (to choose only the filenames instead of open the files immediately) don't seem to be affected, furthermore the error doesn't occur on Linux or WinXP.
msg100022 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-02-24 10:14
I reproduce on winXP, and the explanation is simpler: askopenfilenames() returns a string, like "C:/t C:/t2", which is split into single chars...

It works if I set Tkinter.wantobjects to False, but I don't know what this means.
msg100036 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-02-24 15:18
I'll have to try 7 later, but I'm not seeing this on XP.

Changing type from crash to behavior, as this appears to just be an IOError.
msg197771 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-09-15 13:16
Looks as a duplicate of issue5712.
History
Date User Action Args
2022-04-11 14:56:58adminsetgithub: 52258
2013-10-13 17:59:53georg.brandlsetstatus: pending -> closed
superseder: tkinter - askopenfilenames returns string instead of tuple in windows 2.6.1 release
resolution: duplicate
2013-09-15 13:16:46serhiy.storchakasetstatus: open -> pending
nosy: + serhiy.storchaka
messages: + msg197771
2012-03-12 17:18:18tleshersetnosy: + tlesher
2010-02-24 15:18:34brian.curtinsetpriority: normal

type: crash -> behavior
components: + Windows

nosy: + brian.curtin
messages: + msg100036
stage: needs patch

2010-02-24 10:14:21amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg100022
2010-02-24 09:52:04Patrick.Holzcreate