我有一个salt状态,用于在虚拟环境中安装-r requirements.txt。当为一个特定的开发包将脚本复制到{venv}/bin时,它会由于UnicodeDecodeError而崩溃。
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)我试着在盐之外重复这个错误,但我没有做到。我试过:
pip install -r requirements.txtpython setup.py developpython -c "import setuptools, tokenize;… (参见回溯的顶部)我在虚拟环境的内部和外部都尝试了上面的方法,使用了新的和现有的安装。我尝试过的大多数搜索都显示UnicodeDecodeError在日志中写入,但这似乎是通过读取特定的文件来实现的。我不知道下一步该做什么,也不知道如何进入盐业,找出它与我的不同之处。
以下是相关的盐州:
# 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我如何调试这个?
发布于 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断点并检查情况。
https://stackoverflow.com/questions/35015292
复制相似问题