BUG? Unicode and Python 2.0

C. Meyer kgmeyer at comundo.de
Sat Jun 16 13:14:56 EDT 2001


Hello,

the file tkfiledialog.py from python/lib/lib-tk has some test code:

if __name__ == "__main__":

    print "open", askopenfilename(filetypes=[("all filez", "*")])
    print "saveas", asksaveasfilename()


I tried it, but it won't work, if i select filenames with umlaut:

C:\Programme\Python\Lib\lib-tk>python tkfiledialog.py
open
Traceback (most recent call last):
  File "tkfiledialog.py", line 105, in ?
    print "open", askopenfilename(filetypes=[("all filez", "*")])
UnicodeError: ASCII encoding error: ordinal not in range(128)


The reason is (i think), that askopenfilename surprisingly returns
unicode string instead of string.

If functions return sometimes unicode strings, how should this be done?

Is this a bug or a design problem, or do i misunderstand this?






More information about the Python-list mailing list