Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8509ebc8
Commit
8509ebc8
authored
Apr 08, 2002
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #539392: Invoke setlocale, try opening the file in demo mode.
parent
95de5c16
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
Lib/lib-tk/tkFileDialog.py
Lib/lib-tk/tkFileDialog.py
+18
-2
No files found.
Lib/lib-tk/tkFileDialog.py
View file @
8509ebc8
...
@@ -130,14 +130,30 @@ if __name__ == "__main__":
...
@@ -130,14 +130,30 @@ if __name__ == "__main__":
# Start off with UTF-8
# Start off with UTF-8
enc
=
"utf-8"
enc
=
"utf-8"
import
sys
# See whether CODESET is defined
# See whether CODESET is defined
try
:
try
:
import
locale
import
locale
locale
.
setlocale
(
locale
.
LC_ALL
,
''
)
enc
=
locale
.
nl_langinfo
(
locale
.
CODESET
)
enc
=
locale
.
nl_langinfo
(
locale
.
CODESET
)
except
(
ImportError
,
AttributeError
):
except
(
ImportError
,
AttributeError
):
pass
pass
print
"open"
,
askopenfilename
(
filetypes
=
[(
"all files"
,
"*"
)]).
encode
(
enc
)
# dialog for openening files
print
"saveas"
,
asksaveasfilename
().
encode
(
enc
)
openfilename
=
askopenfilename
(
filetypes
=
[(
"all files"
,
"*"
)])
try
:
fp
=
open
(
openfilename
,
"r"
)
fp
.
close
()
except
:
print
"Could not open File: "
print
sys
.
exc_info
()[
1
]
print
"open"
,
openfilename
.
encode
(
enc
)
# dialog for saving files
saveasfilename
=
asksaveasfilename
()
print
"saveas"
,
saveasfilename
.
encode
(
enc
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment