Skip to content

Commit bbf1cab

Browse files
Federico Ceratto federico cerattoFederico Ceratto federico ceratto
authored andcommitted
Fixed a bug in writing the conf file and another in handling missing section from such file.
user: Federico Ceratto federico.ceratto@gmail.com changed bpython/cli.py
1 parent e945829 commit bbf1cab

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bpython/cli.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,7 @@ def migrate_rc(path):
17721772
v = bools[v.lower()]
17731773
config.set('general', k, v)
17741774
f.close()
1775-
f = open(os.path.expanduser('~/.bpython.ini'))
1775+
f = open(os.path.expanduser('~/.bpython.ini'), 'w')
17761776
config.write(f)
17771777
f.close()
17781778

@@ -1784,7 +1784,9 @@ def safeget(self, section, option, default):
17841784
"""safet get method using default values"""
17851785
try:
17861786
v = self.get(section, option)
1787-
except NoSectionError, NoOptionError:
1787+
except NoSectionError:
1788+
v = default
1789+
except NoOptionError:
17881790
v = default
17891791
if isinstance(v, bool):
17901792
return v

0 commit comments

Comments
 (0)