Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > tkFileDialog, askopenfiles in v2.6 question

Reply
Thread Tools

tkFileDialog, askopenfiles in v2.6 question

 
 
fransstil
Guest
Posts: n/a
 
      11-26-2008
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[i] = fnames[i].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/ =-

 
Reply With Quote
 
 
 
 
MRAB
Guest
Posts: n/a
 
      11-27-2008
fransstil wrote:
> 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[i] = fnames[i].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).
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
question row filter (more of sql query question) =?Utf-8?B?YW5kcmV3MDA3?= ASP .Net 2 10-06-2005 01:07 PM
Quick Question - Newby Question =?Utf-8?B?UnlhbiBTbWl0aA==?= ASP .Net 4 02-16-2005 11:59 AM
Question on Transcender Question :-) eddiec MCSE 6 05-20-2004 06:59 AM
Question re: features of the 831 router (also a 924 question) Wayne Cisco 0 03-02-2004 07:57 PM
Syntax Question - Novice Question sean ASP .Net 1 10-20-2003 12:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57