[New-bugs-announce] [issue10316] tkFileDialog.askopenfilenames scrambling multiple file selection
report at bugs.python.org
Thu Nov 4 21:56:11 CET 2010
New submission from Peter Hall <Peter.F.Hall at nasa.gov>:
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",
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.
title: tkFileDialog.askopenfilenames scrambling multiple file selection
versions: Python 2.5
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce