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

tkFileDialog.askopenfilenames scrambling multiple file selection #54525

Closed
pfhall mannequin opened this issue Nov 4, 2010 · 3 comments
Closed

tkFileDialog.askopenfilenames scrambling multiple file selection #54525

pfhall mannequin opened this issue Nov 4, 2010 · 3 comments
Labels
topic-tkinter type-bug An unexpected behavior, bug, or error

Comments

@pfhall
Copy link
Mannequin

pfhall mannequin commented Nov 4, 2010

BPO 10316
Nosy @ned-deily

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 = None
closed_at = <Date 2010-11-05.00:14:52.530>
created_at = <Date 2010-11-04.20:56:05.804>
labels = ['type-bug', 'expert-tkinter']
title = 'tkFileDialog.askopenfilenames scrambling multiple file selection'
updated_at = <Date 2010-11-08.01:37:34.568>
user = 'https://bugs.python.org/pfhall'

bugs.python.org fields:

activity = <Date 2010-11-08.01:37:34.568>
actor = 'ned.deily'
assignee = 'none'
closed = True
closed_date = <Date 2010-11-05.00:14:52.530>
closer = 'ned.deily'
components = ['Tkinter']
creation = <Date 2010-11-04.20:56:05.804>
creator = 'pfhall'
dependencies = []
files = []
hgrepos = []
issue_num = 10316
keywords = []
message_count = 3.0
messages = ['120438', '120461', '120702']
nosy_count = 2.0
nosy_names = ['ned.deily', 'pfhall']
pr_nums = []
priority = 'normal'
resolution = 'works for me'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue10316'
versions = ['Python 2.5']

@pfhall
Copy link
Mannequin Author

pfhall mannequin commented Nov 4, 2010

I am running the following :

Linux Centos version 2.6.18
Python version 2.5
tk version 8.5
tcl version 8.5

I have a Python GUI program (importing Tkinter and tkFileDialog)
which prompts the user to select a (one to many) list of file names.
The code is :

fileList = tkFileDialog.askopenfilenames(initialdir=self.startfiledir,
                                         title="Select Files for Processing",
                                         filetypes=self.ftypes, multiple=1)

where "startfiledir" and "ftypes" are defined elsewhere.
When this code is run a file selection box pops up
listing the chosen directory. Selecting just one file works fine.

To select multiple files the user highlights a selection
of the displayed files by dragging the cursor over them
with "SHIFT left-mouse-button" pressed.
It also lists ALL the selected files in the "File names:" selection field
at the bottom of the selection box. These are separated by spaces.
Clicking "Open" results in the selection box program trying to treat
the entire list as a single file name.
IE. It looks for a single file called "/home/mydir/file1 file2 file3 file4".
Since there is no such file an error pop-up box appears with a
"File ... does not exist." message.

It appears that the file name list is not being parsed into indivdual file names.
I have tried combinations with "askopenfilename" instead of "askopenfilenames"
and including/omitting "multiple=1".
I have also tried "multiple=bool(1)" and "multiple=xxx"
where "xxx=1" and "xxx=bool(1)".
None of these change the behaviour.

Is there a fault with my code ?
Is this a bug in "tkFileDialog.askopenfilenames" ?
Is there a workaround ?

Suggestions are welcome.

@pfhall pfhall mannequin added topic-tkinter type-bug An unexpected behavior, bug, or error labels Nov 4, 2010
@ned-deily
Copy link
Member

Works for me on a current Debian Linux system with a Debian Python 2.5.5 + Tcl/Tk 8.5 and with Python 2.6.1 + Tcl/Tk 8.5 on OS X 10.6 and with Python 2.7 + Tcl/Tk 8.4 on OS X 10.6. In all cases, the tkFileDialog.askopenfilenames returns a tuple of absolute file paths. (BTW, only security issues are accepted for Python 2.5 at this time).

@ned-deily
Copy link
Member

Postscript: I've subsequently noticed bpo-5712 in which somewhat similar symptoms are reported but, so far, only on Windows systems. If your problem is not yet resolved, you might want to chime in there.

@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
topic-tkinter type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant