tkFileDialog and locale under Linux

M

Matthias Huening

Hi,

I have problems using tkFileDialog under Linux (Ubuntu 8.04 in my case, but
other Linuxes seem to show the same behaviour).

The following works fine:

import tkFileDialog
f = tkFileDialog.askopenfilename()

No problem, I can chose a filename.

But when switching the locale (in my case to German) like this:

import locale
locale.setlocale(locale.LC_ALL, '')

the file dialog won't work anymore. The traceback is:

Traceback (most recent call last):
File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1406, in __call__
return self.func(*args)
File "TextSTAT.pyw", line 701, in datei_hinzu
dateinamen = tkFileDialog.askopenfilename(initialdir=cfg['FileDir'],
filetypes= (('All', '*.*'),('Text', '*.txt'),('HTML', '*.htm*'),('MS Word',
'*.doc'),('MS Word 2007', '*.docx'),('OpenOffice 1.x',
'*.sxw'),('OpenOffice 2.x', '*.odt')), multiple=1)
File "/usr/lib/python2.5/lib-tk/tkFileDialog.py", line 125, in
askopenfilename
return Open(**options).show()
File "/usr/lib/python2.5/lib-tk/tkCommonDialog.py", line 48, in show
s = w.tk.call(self.command, *w._options(self.options))
TclError: expected floating-point number but got "0.0"


Switching back to the C-locale solves the problem:
locale.setlocale(locale.LC_ALL, 'C')

tkFileDialog will work again.

Any ideas?

Best, Matthias
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top