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: tkinter askopenfilenames does not work in Windows library folder
Type: behavior Stage: resolved
Components: Tkinter, Windows Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: tkinter with wantobjects=False has been broken for some time
View: 3015
Assigned To: serhiy.storchaka Nosy List: AJNeufeld, serhiy.storchaka, tegavu, terry.reedy
Priority: normal Keywords: patch

Created on 2013-08-29 18:52 by tegavu, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tkinter_Tkapp_CallResult.patch serhiy.storchaka, 2013-09-15 11:00 review
Messages (7)
msg196479 - (view) Author: (tegavu) Date: 2013-08-29 18:52
Using Python 3.3 on W7x64 I wanted to create a file dialog that allows me to select multiple files.
The code below is an example of how to re-create the bug.

# -*- coding: iso-8859-15 -*-
# Python 3

import tkinter 
import tkinter.filedialog  

def callback():
    name = tkinter.filedialog.askopenfilenames() 
    print(name)
     
tkinter.Button(text='File Open', command=callback).pack()
tkinter.mainloop()


---------
THE PROBLEM:
When selecting any file in the windows library\* folders (those: http://beingpc.com/wp-content/uploads/2011/05/How-to-Change-the-Windows-7-Library-Icon.jpg ) the return value that will be printed is always {}.
tkinter.filedialog.askopenfilename() (without the 's') works fine also in those directories.

Can anyone reproduce this behavior?
msg196590 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-08-30 22:27
There was a issue about people not being able to open windows 'library' files from Idle, but it was determined not to be an Idle problem. I cannot find it now. The outcome may have been that this was presumed to be a tk bug, but your report about the alternate dialog is interesting. it.
msg197761 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-09-15 10:53
I guess tkinter.wantobjects is 0 for you?
msg197762 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-09-15 11:00
This patch should fix the issue (as many other issues).
msg197768 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-09-15 12:53
See also #3015 and #5712.
msg206588 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-12-19 07:57
Already applied in issue3015.
msg218484 - (view) Author: Arthur Neufeld (AJNeufeld) * Date: 2014-05-13 20:32
I'd like this issue to be reopened.  It does not appear resolved.  It is different from the wantobjects=False issue.

Windows 7 has 'libraries' which are folders containing the contents of more than one folder.  For instance, on my computer
   > Libraries > Documents
presents the contents of the following 2 folders simultaneously:
   C:\Users\aneufeld\Documents
   C:\Users\Public\Documents

If you execute the script listed in the original bug report, press the [File Open] button, press "Libraries" from the left bar, double click "Documents" in the main area, and select one or more *FILES* in the displayed list of files, I get back:
   ('',)

On the other hand, if I press "Computer" on the left bar, and navigate through "C:", "Users", "aneufeld", "My Documents", and select the SAME FILES, I get back:
   ('C:/Users/aneufeld/Documents/timelog.txt', 'C:/Users/aneufeld/Documents/notes.txt')

From the "> Libraries > Documents" folder, if you navigate into any real folder, the problem goes away.  For example, with the folder ATS in My Documents, press the [File Open] button, press "Libraries" from the left bar, double click "Documents" in the main area, double click ATS, and select the two files, I get:
   ('C:/Users/aneufeld/Documents/ATS/readme.txt', 'C:/Users/aneufeld/Documents/ATS/Changes.txt')

The issue is, when the file "Foo.txt" is selected in a Library folder, such as "Documents", the dialog does not know if that file should be:
   C:/Users/aneufeld/Documents/Foo.txt
or
   C:/Users/Public/Documents/Foo.txt
and returns a null string for the filename.
History
Date User Action Args
2022-04-11 14:57:50adminsetgithub: 63077
2014-05-13 20:32:56AJNeufeldsetnosy: + AJNeufeld
messages: + msg218484
2013-12-19 07:57:04serhiy.storchakasetstatus: open -> closed
superseder: tkinter with wantobjects=False has been broken for some time
messages: + msg206588

resolution: duplicate
stage: patch review -> resolved
2013-09-15 12:53:21serhiy.storchakasetmessages: + msg197768
2013-09-15 11:00:43serhiy.storchakasetfiles: + tkinter_Tkapp_CallResult.patch
versions: + Python 3.4
messages: + msg197762

assignee: serhiy.storchaka
keywords: + patch
stage: needs patch -> patch review
2013-09-15 10:53:19serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg197761
2013-08-30 22:27:01terry.reedysetnosy: + terry.reedy

messages: + msg196590
stage: needs patch
2013-08-29 18:52:47tegavucreate