8000 Update sort-ini.py script (#591) · python/planet@154f515 · GitHub
[go: up one dir, main page]

Skip to content

Commit 154f515

Browse files
authored
Update sort-ini.py script (#591)
Update sort-ini.py script to work with Python 3
1 parent 46fd878 commit 154f515

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

config/sort-ini.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#!/usr/bin/env python
22

33
import sys
4-
import ConfigParser
4+
import configparser
55

66
if len(sys.argv) > 1:
77
filename = sys.argv[1]
88
else:
99
filename = 'config.ini'
1010

11-
oconfig = ConfigParser.RawConfigParser()
11+
oconfig = configparser.RawConfigParser()
1212
oconfig.read(filename)
1313

1414
# This part will destroy the configuration if there's a crash while
1515
# writing the output. We're in an GIT-controlled directory, so
1616
# I didn't care enough to fix this.
17-
with open(filename, 'wb') as fd:
17+
with open(filename, 'w', encoding='utf-8') as fd:
1818
# Copy of write() code that sorts output by section
1919
if oconfig._defaults:
2020
fd.write("[%s]\n" % DEFAULTSECT)

0 commit comments

Comments
 (0)
You can’t perform that action at this time.
0