Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tkinter askopenfilenames does not work in Windows library folder #63077

Closed
tegavu mannequin opened this issue Aug 29, 2013 · 7 comments
Closed

tkinter askopenfilenames does not work in Windows library folder #63077

tegavu mannequin opened this issue Aug 29, 2013 · 7 comments
Assignees
Labels
OS-windows topic-tkinter type-bug An unexpected behavior, bug, or error

Comments

@tegavu
Copy link
Mannequin

tegavu mannequin commented Aug 29, 2013

BPO 18877
Nosy @terryjreedy, @serhiy-storchaka, @AJNeufeld
Superseder
  • bpo-3015: tkinter with wantobjects=False has been broken for some time
  • Files
  • tkinter_Tkapp_CallResult.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2013-12-19.07:57:04.233>
    created_at = <Date 2013-08-29.18:52:47.670>
    labels = ['type-bug', 'expert-tkinter', 'OS-windows']
    title = 'tkinter askopenfilenames does not work in Windows library folder'
    updated_at = <Date 2014-05-13.20:32:56.267>
    user = 'https://bugs.python.org/tegavu'

    bugs.python.org fields:

    activity = <Date 2014-05-13.20:32:56.267>
    actor = 'AJNeufeld'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2013-12-19.07:57:04.233>
    closer = 'serhiy.storchaka'
    components = ['Tkinter', 'Windows']
    creation = <Date 2013-08-29.18:52:47.670>
    creator = 'tegavu'
    dependencies = []
    files = ['31768']
    hgrepos = []
    issue_num = 18877
    keywords = ['patch']
    message_count = 7.0
    messages = ['196479', '196590', '197761', '197762', '197768', '206588', '218484']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'serhiy.storchaka', 'tegavu', 'AJNeufeld']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '3015'
    type = 'behavior'
    url = 'https://bugs.python.org/issue18877'
    versions = ['Python 3.3', 'Python 3.4']

    @tegavu
    Copy link
    Mannequin Author

    tegavu mannequin commented Aug 29, 2013

    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?

    @tegavu tegavu mannequin added topic-tkinter OS-windows type-bug An unexpected behavior, bug, or error labels Aug 29, 2013
    @terryjreedy
    Copy link
    Member

    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.

    @serhiy-storchaka
    Copy link
    Member

    I guess tkinter.wantobjects is 0 for you?

    @serhiy-storchaka
    Copy link
    Member

    This patch should fix the issue (as many other issues).

    @serhiy-storchaka serhiy-storchaka self-assigned this Sep 15, 2013
    @serhiy-storchaka
    Copy link
    Member

    See also bpo-3015 and bpo-5712.

    @serhiy-storchaka
    Copy link
    Member

    Already applied in bpo-3015.

    @AJNeufeld
    Copy link
    Mannequin

    AJNeufeld mannequin commented May 13, 2014

    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.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    OS-windows topic-tkinter type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants