首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何调试salt.states.pip.installed?

如何调试salt.states.pip.installed?
EN

Stack Overflow用户
提问于 2016-01-26 13:47:08
回答 1查看 687关注 0票数 0

我有一个salt状态,用于在虚拟环境中安装-r requirements.txt。当为一个特定的开发包将脚本复制到{venv}/bin时,它会由于UnicodeDecodeError而崩溃。

代码语言:javascript
复制
Running setup.py develop for pymantic
    Complete output from command /home/michaels/webapps/test/bin/python -c "import setuptools, tokenize;__file__='/home/michaels/webapps/test/src/pymantic/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps:
    running develop
    running egg_info
    writing requirements to pymantic.egg-info/requires.txt
    writing pymantic.egg-info/PKG-INFO
    writing top-level names to pymantic.egg-info/top_level.txt
    writing dependency_links to pymantic.egg-info/dependency_links.txt
    writing entry points to pymantic.egg-info/entry_points.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'pymantic.egg-info/SOURCES.txt'
    writing manifest file 'pymantic.egg-info/SOURCES.txt'
    running build_ext
    Creating /home/michaels/webapps/test/lib/python2.7/site-packages/pymantic.egg-link (link to .)
    Adding pymantic 0.2.0dev-r0 to easy-install.pth file
    Installing named_graph_to_nquads script to /home/michaels/webapps/test/bin
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/michaels/webapps/test/src/pymantic/setup.py", line 38, in <module>
        'pymantic/scripts/bnf2html',
      File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/home/michaels/webapps/test/local/lib/python2.7/site-packages/setuptools/command/develop.py", line 34, in run
        self.install_for_development()
      File "/home/michaels/webapps/test/local/lib/python2.7/site-packages/setuptools/command/develop.py", line 133, in install_for_development
        self.process_distribution(None, self.dist, not self.no_deps)
      File "/home/michaels/webapps/test/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 697, in process_distribution
        self.install_egg_scripts(dist)
      File "/home/michaels/webapps/test/local/lib/python2.7/site-packages/setuptools/command/develop.py", line 168, in install_egg_scripts
        script_text = strm.read()
      File "/home/michaels/webapps/test/lib/python2.7/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 59: ordinal not in range(128)

我试着在盐之外重复这个错误,但我没有做到。我试过:

  1. pip install -r requirements.txt
  2. python setup.py develop
  3. python -c "import setuptools, tokenize;… (参见回溯的顶部)

我在虚拟环境的内部和外部都尝试了上面的方法,使用了新的和现有的安装。我尝试过的大多数搜索都显示UnicodeDecodeError在日志中写入,但这似乎是通过读取特定的文件来实现的。我不知道下一步该做什么,也不知道如何进入盐业,找出它与我的不同之处。

以下是相关的盐州:

代码语言:javascript
复制
# Create apps virtualenv, install requirements on change to repo
{{ user }}-{{ repo }}-apps-virtualenv:
  virtualenv.managed:
    - name: /home/{{ user }}/webapps/{{ repo }}
    - cwd: /home/{{ user }}/webapps/{{ repo }}/src/app
    - system_site_packages: False
    - user: {{ user }}
    - require:
      - git: {{ user }}-{{ repo }}-apps-repo
{{ user }}-{{ repo }}-apps-requirements:
  pip.installed:
    - bin_env: /home/{{ user }}/webapps/{{ repo }}/bin/pip
    - cwd: /home/{{ user }}/webapps/{{ repo }}/src/app
    - requirements: /home/{{ user }}/webapps/{{ repo }}/src/app/requirements.txt
    - user: {{ user }}
    - require:
      - virtualenv: {{ user }}-{{ repo }}-apps-virtualenv
    - watch:
      - git: {{ user }}-{{ repo }}-apps-repo
    - env_vars:
      - LC_ALL: en_US.UTF-8

我如何调试这个?

EN

回答 1

Stack Overflow用户

发布于 2016-01-27 01:14:43

这可能是由于在不同的用户env下运行时,不同的locale/env设置。试着用盐叫跑步。假设您安装了虚拟包装器:

mkvirtualenv foo salt-call --local --log-level debug pip.install pkgs=slugify bin_env=$HOME/.virtualenvs/foo

然后使用sudo / sudo su root或其他用户/env尝试同样的方法,您的盐分运行在下面。同时,尝试在前景上运行仆从。最后,在使用salt调用时,您可以简单地在pip.py salt模块中插入一个pdb断点并检查情况。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35015292

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档