snapcraft注册失败,“无法编码字符”

时间:2017-09-11 21:49:51

标签: python snapcraft

我正在(https://tutorials.ubuntu.com/tutorial/create-your-first-snap

上完成创建你的第一个快照教程

我已经进入第7步(上传到商店)并且卡在注册应用名称的步骤上。

正在运行snapcraft register hello-pward123

返回以下python错误堆栈:

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)

我的snapfile.yaml看起来像:

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"]

我在Ubuntu 16.04.3上运行snapcraft 2.33

1 个答案:

答案 0 :(得分:1)

我们使用click来解析cli,它需要UTF-8作为documented here

那就是说,这个错误是不幸的,应该修复。