Execute resource failing on special characters?


#1

One of my recipes deploys a Django app and then installs the dependencies
into the virtualenv like so:

execute “/my-virtualenv/bin/pip install -r /var/www/
mysite.com/current/requirements.txt” do
cwd "/var/www/mysite.com/current"
end

This is failing when it tries to install unicodecsv
https://github.com/jdunck/python-unicodecsv:

UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 615:
ordinal not in range(128)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File “”, line 20, in
File “/tmp/pip-build-ik16hgxe/unicodecsv/setup.py”, line 11, in
long_description=open(os.path.join(os.path.dirname(file),
‘README.rst’), ‘r’).read(),
File “/my-virtualenv/lib/python3.4/encodings/ascii.py”, line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 615:
ordinal not in range(128)

Apparently it doesn’t like the special characters in the README.rst of that
package.

However, if I run the command manually from a bash prompt as root, it works
fine. How come it fails when execute tries to do it? I’m running
chef-client 11.16.2. Thanks!


#2

On 4/17/15 2:45 PM, Greg Barker wrote:

One of my recipes deploys a Django app and then installs the
dependencies into the virtualenv like so:

execute “/my-virtualenv/bin/pip install -r
/var/www/mysite.com/current/requirements.txt
http://mysite.com/current/requirements.txt” do
cwd "/var/www/mysite.com/current http://mysite.com/current"
end

This is failing when it tries to install unicodecsv
https://github.com/jdunck/python-unicodecsv:

UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position
615: ordinal not in range(128)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File “”, line 20, in
File “/tmp/pip-build-ik16hgxe/unicodecsv/setup.py”, line 11, in
long_description=open(os.path.join(os.path.dirname(file),
‘README.rst’), ‘r’).read(),
File “/my-virtualenv/lib/python3.4/encodings/ascii.py”, line 26, in
decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position
615: ordinal not in range(128)

Apparently it doesn’t like the special characters in the README.rst of
that package.

However, if I run the command manually from a bash prompt as root, it
works fine. How come it fails when execute tries to do it? I’m running
chef-client 11.16.2. Thanks!
Its probably running that with LC_ALL=C, try using Chef 12.x which
should have fixed that problem.