Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7790297 commit 85f9814Copy full SHA for 85f9814
1 file changed
Lib/lib-tk/tkFileDialog.py
@@ -124,6 +124,20 @@ def askdirectory (**options):
124
# test stuff
125
126
if __name__ == "__main__":
127
+ # Since the file name may contain non-ASCII characters, we need
128
+ # to find an encoding that likely supports the file name, and
129
+ # displays correctly on the terminal.
130
+
131
+ # Start off with UTF-8
132
+ enc = "utf-8"
133
134
+ # See whether CODESET is defined
135
+ try:
136
+ import locale
137
+ enc = locale.nl_langinfo(locale.CODESET)
138
+ except (ImportError, AttributeError):
139
+ pass
140
141
+ print "open", askopenfilename(filetypes=[("all filez", "*")]).encode(enc)
142
+ print "saveas", asksaveasfilename().encode(enc)
143
- print "open", askopenfilename(filetypes=[("all filez", "*")])
- print "saveas", asksaveasfilename()
0 commit comments