Skip to content

Commit 31c64f3

Browse files
marcelotduartedjc
authored andcommitted
py3 fixes
1 parent 3af398f commit 31c64f3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

couchdb/tools/load.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
file.
1212
"""
1313

14+
from __future__ import print_function
1415
from base64 import b64encode
1516
from optparse import OptionParser
1617
import sys
@@ -36,7 +37,7 @@ def load_db(fileobj, dburl, username=None, password=None, ignore_errors=False):
3637
doc['_attachments'] = {}
3738
else:
3839
doc['_attachments'][headers['content-id']] = {
39-
'data': b64encode(payload),
40+
'data': b64encode(payload).decode('ascii'),
4041
'content_type': headers['content-type'],
4142
'length': len(payload)
4243
}
@@ -45,13 +46,13 @@ def load_db(fileobj, dburl, username=None, password=None, ignore_errors=False):
4546
doc = json.decode(payload)
4647

4748
del doc['_rev']
48-
print>>sys.stderr, 'Loading document %r' % docid
49+
print('Loading document %r' % docid, file=sys.stderr)
4950
try:
5051
db[docid] = doc
5152
except Exception as e:
5253
if not ignore_errors:
5354
raise
54-
print>>sys.stderr, 'Error: %s' % e
55+
print('Error: %s' % e, file=sys.stderr)
5556

5657

5758
def main():

0 commit comments

Comments
 (0)