Buck fails when used within PyRun
Created by: mikeb01
Given a simple Buck configuration:
java_library(
name = 'main',
srcs = [ 'src/Main.java' ]
)
java_binary(
name = 'main-jar',
deps = [ ':main' ],
main_class = 'Main'
)
If I create a minimal python installation using PyRun
$ wget https://downloads.egenix.com/python/install-pyrun
$ ./install-pyrun -m pyrun
$ pushd pyrun/bin
$ ln -s python2.7 python2
$ popd
$ export PATH=pyrun/bin:$PATH
Then run the main jar
$ ./buck.pex run main-jar
I get the following error
Building: finished in 0.0 sec (100%) 1/1 jobs, 0 updated
Total time: 0.0 sec
unknown encoding: utf8
Traceback (most recent call last):
File "programs/buck.py", line 241, in <module>
File "programs/buck.py", line 227, in main
File "programs/buck_tool.py", line 543, in launch_buck
run_fn, env, argv, java11_test_mode
File "programs/buck_tool.py", line 452, in _execute_command_and_maybe_run_target
path = cmd["path"].encode("utf8")
LookupError: unknown encoding: utf8
This appears to be some sort of interaction between pyrun and buck's sandboxing as encode works fine outside of buck. E.g. pyrun/bin/python2 -c 'print("123".encode("utf8"))'
works without issue.