temporary fix for TypeError exception at init
This commit is contained in:
parent
825966d34e
commit
0aaf094fa1
@ -66,12 +66,12 @@ class Config(object):
|
||||
if not check_file(path, fail=False):
|
||||
raise IOError(("The configuration file {} does not exist."
|
||||
" Did you run 'pubs init' ?").format(path))
|
||||
with _open(path, 'r') as f:
|
||||
with _open(path, 'rb+') as f:
|
||||
_read_config(self._cfg, f)
|
||||
return self
|
||||
|
||||
def save(self, path=DFT_CONFIG_PATH):
|
||||
with _open(path, 'w') as f:
|
||||
with _open(path, 'wb+') as f:
|
||||
self._cfg.write(f)
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
|
@ -15,7 +15,7 @@ from .p3 import urlparse, HTTPConnection, urlopen
|
||||
"""
|
||||
|
||||
|
||||
ENCODING = 'utf8'
|
||||
ENCODING = 'UTF-8'
|
||||
|
||||
|
||||
# files i/o
|
||||
@ -45,7 +45,10 @@ def system_path(path):
|
||||
|
||||
|
||||
def _open(path, mode):
|
||||
return io.open(system_path(path), mode, encoding=ENCODING)
|
||||
if mode.find('b') == -1:
|
||||
return io.open(system_path(path), mode, encoding=ENCODING)
|
||||
else:
|
||||
return io.open(system_path(path), mode)#, encoding=ENCODING)
|
||||
|
||||
|
||||
def check_file(path, fail=True):
|
||||
|
Loading…
x
Reference in New Issue
Block a user