snapcraft register failing with "can't encode character"

75 views Asked by At

I'm running through the Create Your First Snap tutorial at (https://tutorials.ubuntu.com/tutorial/create-your-first-snap)

I've made it to step 7 (Upload to the store) and am stuck on the step where you register the app name.

Running snapcraft register hello-pward123

returns the following python error stack:

Traceback (most recent call last):
  File "/usr/bin/snapcraft", line 9, in <module>
    load_entry_point('snapcraft==2.33', 'console_scripts', 'snapcraft')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/__main__.py", line 19, in <module>
    run(prog_name='snapcraft')
  File "/usr/lib/python3/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/store.py", line 76, in register
    if click.confirm(_MESSAGE_REGISTER_CONFIRM.format(snap_name)):
  File "/usr/lib/python3/dist-packages/click/termui.py", line 138, in confirm
    echo(prompt, nl=False, err=err)
  File "/usr/lib/python3/dist-packages/click/utils.py", line 259, in echo
    file.write(message)
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2018' in position 255: ordinal not in range(256)

My snapfile.yaml looks like:

name: hello-pward123
version: '2.10'
summary: GNU Hello, the hello world snap
description: |
  GNU hello prints a friendly greeting.
grade: devel
confinement: strict

apps:
  hello:
    command: bin/hello

  bash:
    command: bash

parts:
  gnu-hello:
    source: http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz
    plugin: autotools

  gnu-bash:
    source: http://ftp.gnu.org/gnu/bash/bash-4.3.tar.gz
    plugin: autotools
    configflags: ["--infodir=/var/bash/info"]

I'm running snapcraft 2.33 on Ubuntu 16.04.3

1

There are 1 answers

0
user52763 On BEST ANSWER

We use click to parse the cli and it requires UTF-8 as documented here

That said, this error is unfortunate and should be fixed.