Couchdb: couchup crashes when run with python3

Created on 4 Feb 2019  路  3Comments  路  Source: apache/couchdb

Description

Trying to run couchup with the login and password params crashes the program:

couchup replicate -a --login admin --password <my-password>

Starting replication for event-4e616368746469676974616c203139...
Traceback (most recent call last):
  File "./bin/couchup", line 508, in <module>
    main(sys.argv)
  File "./bin/couchup", line 502, in main
    args.func(args)
  File "./bin/couchup", line 223, in _replicate
    auth = 'Basic ' + base64.b64encode(':'.join(args['creds']))
  File "/usr/lib/python3.6/base64.py", line 58, in b64encode
    encoded = binascii.b2a_base64(s, newline=False)
TypeError: a bytes-like object is required, not 'str

Steps to Reproduce

couchup replicate -a --login admin --password <my-password>

Expected Behaviour

couchup should not crash

Your Environment

  • Ubuntu 18.04.1
  • python --version Python 2.7.15rc1,
  • python3 --version Python 3.6.7
  • fresh CouchDB 2.3.0 install from the couch repo

Additional context

I'm not familiar with python, but it looks like couchup is passing a string to base64.b64encode. Which is fine in python2, but as far as I can tell pyton3 expects a bytes-like object.

Discussed this on slack a little:
https://couchdb.slack.com/archives/C49LEE7NW/p1549215509673600

bug

Most helpful comment

@wohali here you go https://github.com/apache/couchdb/pull/1905 馃檪

All 3 comments

Thanks @klaemo - not able to use that Slack link.

Pull requests welcome ;)

@wohali here you go https://github.com/apache/couchdb/pull/1905 馃檪

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stheobald picture stheobald  路  4Comments

popojargo picture popojargo  路  5Comments

wohali picture wohali  路  5Comments

ngosafety picture ngosafety  路  6Comments

dpdornseifer picture dpdornseifer  路  3Comments