Skip to content

couchup crashes when run with python3 #1899

@klaemo

Description

@klaemo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions