Removed codecs
I removed these calls to codecs because I got the error: ValueError: can't have text and binary mode at once
This commit is contained in:
parent
476c485a52
commit
5e356b0bf5
@ -16,7 +16,6 @@
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
import codecs
|
||||
import re # For folderfilter.
|
||||
import json
|
||||
from threading import Lock
|
||||
@ -120,8 +119,8 @@ class _IntermediateMbnames(object):
|
||||
if self._dryrun:
|
||||
self.ui.info("mbnames would write %s"% self._path)
|
||||
else:
|
||||
with codecs.open(
|
||||
self._path, "wt", encoding='UTF-8') as intermediateFD:
|
||||
with open(
|
||||
self._path, "w", encoding='utf-8') as intermediateFD:
|
||||
json.dump(itemlist, intermediateFD)
|
||||
|
||||
|
||||
@ -235,8 +234,8 @@ class _Mbnames(object):
|
||||
|
||||
for intermediateFile in self._iterIntermediateFiles():
|
||||
try:
|
||||
with codecs.open(
|
||||
intermediateFile, 'rt', encoding="UTF-8") as intermediateFD:
|
||||
with open(
|
||||
intermediateFile, 'r', encoding="utf-8") as intermediateFD:
|
||||
for item in json.load(intermediateFD):
|
||||
itemlist.append(item)
|
||||
except (OSError, IOError) as e:
|
||||
@ -257,8 +256,8 @@ class _Mbnames(object):
|
||||
self.ui.info("mbnames would write %s"% self._path)
|
||||
else:
|
||||
try:
|
||||
with codecs.open(
|
||||
self._path, 'wt', encoding='UTF-8') as mbnamesFile:
|
||||
with open(
|
||||
self._path, 'w', encoding='utf-8') as mbnamesFile:
|
||||
mbnamesFile.write(self._header)
|
||||
mbnamesFile.write(self._sep.join(itemlist))
|
||||
mbnamesFile.write(self._footer)
|
||||
|
@ -19,7 +19,6 @@
|
||||
import os
|
||||
import netrc
|
||||
import errno
|
||||
import codecs
|
||||
from sys import exc_info
|
||||
from threading import Event
|
||||
|
||||
@ -389,7 +388,7 @@ class IMAPRepository(BaseRepository):
|
||||
# 1. Evaluate Repository 'remotepasseval'.
|
||||
passwd = self.getconf('remotepasseval', None)
|
||||
if passwd is not None:
|
||||
return self.localeval.eval(passwd).encode('UTF-8')
|
||||
return self.localeval.eval(passwd).encode('utf-8')
|
||||
# 2. Read password from Repository 'remotepass'.
|
||||
password = self.getconf('remotepass', None)
|
||||
if password is not None:
|
||||
@ -399,7 +398,7 @@ class IMAPRepository(BaseRepository):
|
||||
# 3. Read password from file specified in Repository 'remotepassfile'.
|
||||
passfile = self.getconf('remotepassfile', None)
|
||||
if passfile is not None:
|
||||
fd = codecs.open(os.path.expanduser(passfile), 'r', 'UTF-8')
|
||||
fd = open(os.path.expanduser(passfile), 'r', 'utf-8')
|
||||
password = fd.readline().strip()
|
||||
fd.close()
|
||||
return password.encode('UTF-8')
|
||||
|
Loading…
Reference in New Issue
Block a user