[Tkinter-discuss] tkFileDialog.askopenfilenames returns unicode string instead of tuple in python 2.62

Johnny Vestergaard jkv at unixcluster.dk
Thu Jul 30 22:06:55 CEST 2009


Hi,

I recently upgraded from Python 2.4 to Python 2.6.2 and have had some 
unexpected issues with unicode.

I had the following code working properly in 2.4:

---code start---
import Tkinter
import tkFileDialog
root = Tkinter.Tk()
input_files = tkFileDialog.askopenfilenames(filetypes = [('.TXT files', 
'.txt')], title ="Select files", multiple = 1 )
print type(input_files)
for file in input_files:
    print file
Tkinter.mainloop()
---code end---
 
In 2.4 it returned a tuple containing the selected filenames, but in 
2.6.2 it seems to return a unicode string (which i cant really use for 
anything). It is the same computerm using (windows XP), only difference 
is the version of Python.

Any hints to what might be going on?


The output from 2.6.2:

<type 'unicode'>
{
C
:
/
D
o
c
u
m
e
n
t
s

a
n
d

s
e
t
t
i
n
g
s
..... and continues that way


More information about the Tkinter-discuss mailing list