tkFileDialog, askopenfiles in v2.6 question

F

fransstil

To select a group of files works fine in 2.5
....
from tkFileDialog import askopenfiles

fnames = askopenfiles(title = "Select files",
initialdir = "C:\\temp",
filetypes=[("All", "*.*")])

for i in range(len(fnames)):
fnames = fnames.name
...
return fnames
....

but now 2.6 strange results

- IOError: [Errno 2] No such file or directory: u'{'

- ERROR '.name' no longer exists in 2.6

- If '.name' removed the return of 'askopenfiles' is no longer a list,
it contains braces for some?! of the directories
example: {C:/temp/file1.ext} {C:/temp/file2.ext} {C:/temp/file3.ext}

- askopenfilenames gives the same results

Can someone gave me a hint

Thanks in advance

Frans Stil



--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-
 
M

MRAB

fransstil said:
To select a group of files works fine in 2.5
...
from tkFileDialog import askopenfiles

fnames = askopenfiles(title = "Select files",
initialdir = "C:\\temp",
filetypes=[("All", "*.*")])

for i in range(len(fnames)):
fnames = fnames.name
...
return fnames
...

As far as I can see, "tkFileDialog.py" hasn't changed, but it looks like
one of the modules it uses is 'broken' in some way.
but now 2.6 strange results

- IOError: [Errno 2] No such file or directory: u'{'
Internally it's expecting a method to return a list and is then
iterating through it, but the method is returning a string instead, so
it's actually iterating through that...
- ERROR '.name' no longer exists in 2.6

- If '.name' removed the return of 'askopenfiles' is no longer a list,
it contains braces for some?! of the directories
example: {C:/temp/file1.ext} {C:/temp/file2.ext} {C:/temp/file3.ext}
This a what is being returned internally and it should be splitting it
into a list.
- askopenfilenames gives the same results

Can someone gave me a hint

Thanks in advance
A short-term fix is to use askopenfilenames and split the string
yourself. It's a space-separated list of paths, each path delimited by
braces (and a path might contain a space).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top