Python2 npm3 install fails on unicode output
mrlannigan opened this issue · comments
I found a fix for the problem I am experiencing and so did someone else, awhile ago. Seems that if I use the --debug
flag with the execution of a build
command in a node.js lambda. The install will run then exit with the following truncated error message:
File "/usr/local/lib/python2.7/site-packages/gordon/resources/lambdas.py", line 538, in _collect_lambda_module_content
self.project.puts(out.decode("utf-8"))
File "/usr/local/lib/python2.7/site-packages/gordon/core.py", line 129, in puts
puts(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/clint/textui/core.py", line 58, in puts
s = map(str, s)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)
I later discovered after some digging that it was complaining about displaying a (✓) \u2713
. This likely has something to do with the progress bar that npm displays and the fact that in python2 the str
encode doesn't gracefully handle unicode characters. Disclaimer: I'm relatively new to python so please do correct me if I'm wrong.
My versions:
$ python --version
Python 2.7.12
$ node -v
v4.6.1
$ npm -v
3.10.9
I'm merely posting this for posterity.
Update:
The clint
PR has been merged.
I also experienced this. --debug
is usually what you pass when troubleshooting something, so it's confusing to have it generate its own problems.