Hey! I am getting a long, strange error message wh...
# general
f
Hey! I am getting a long, strange error message when running my tests. It looks like this: --- snipped into thread --- [1]
Copy code
16:58:41.31 [ERROR] 1 Exception encountered:

Engine traceback:
  in `test` goal

ProcessExecutionFailure: Process 'Building local_dists.pex' failed with exit code 1.
stdout:

stderr:
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '.python-build-standalone/python/bin/python3'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '.python-build-standalone/python/bin/python3'
  sys.base_prefix = '.python-build-standalone/python'
  sys.base_exec_prefix = '.python-build-standalone/python'
  sys.platlibdir = 'lib'
  sys.executable = '.python-build-standalone/python/bin/python3'
  sys.prefix = '.python-build-standalone/python'
  sys.exec_prefix = '.python-build-standalone/python'
  sys.path = [
    '.python-build-standalone/python/lib/python39.zip',
    '.python-build-standalone/python/lib/python3.9',
    '.python-build-standalone/python/lib/python3.9/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
Traceback (most recent call last):
  File "<frozen importlib._bootstrap_external>", line 1362, in _path_importer_cache
KeyError: '.python-build-standalone/python/lib/python3.9'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 982, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 925, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1423, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1392, in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1364, in _path_importer_cache
  File "<frozen importlib._bootstrap_external>", line 1340, in _path_hooks
  File "<frozen importlib._bootstrap_external>", line 1610, in path_hook_for_FileFinder
  File "<frozen importlib._bootstrap_external>", line 1486, in __init__
FileNotFoundError: [Errno 2] No such file or directory



Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
I am using a Docker environment that runs tests on
x86_64
, while my mac has an M1. This error only appears when I include a specific test, and stops happening when I comment out that test. That test looks like this: --- snipped into thread --- [2]
Copy code
python_test(
   name = "integration_test",
   source = "integration_test.py",
   runtime_package_dependencies = [
      ":me", # (a docker image)
   ],
   tags = [
      "integration-test",
   ],
   environment = "__local__",
)
This test uses the Docker SDK to run a container and send it requests. Any idea what’s going on here?
1
Ohh, and I fixed it! The pex binary inserted into the image in question (
:me
) did not have
execution_mode = "venv"
. So problem solved. Feel free to delete or maybe leave around so that people can find this thread when searching for the error message.
👍 1
r
Just a small suggestion. When you have such long code or traceback. It's bit nice to put it inside the thread. Makes life bit easier especially if you are browsing from phone.
f
Yeah sorry, I realized that. Sorry for being a nuisance! 😄
[1]
Copy code
16:58:41.31 [ERROR] 1 Exception encountered:

Engine traceback:
  in `test` goal

ProcessExecutionFailure: Process 'Building local_dists.pex' failed with exit code 1.
stdout:

stderr:
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '.python-build-standalone/python/bin/python3'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '.python-build-standalone/python/bin/python3'
  sys.base_prefix = '.python-build-standalone/python'
  sys.base_exec_prefix = '.python-build-standalone/python'
  sys.platlibdir = 'lib'
  sys.executable = '.python-build-standalone/python/bin/python3'
  sys.prefix = '.python-build-standalone/python'
  sys.exec_prefix = '.python-build-standalone/python'
  sys.path = [
    '.python-build-standalone/python/lib/python39.zip',
    '.python-build-standalone/python/lib/python3.9',
    '.python-build-standalone/python/lib/python3.9/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
Traceback (most recent call last):
  File "<frozen importlib._bootstrap_external>", line 1362, in _path_importer_cache
KeyError: '.python-build-standalone/python/lib/python3.9'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 982, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 925, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1423, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1392, in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1364, in _path_importer_cache
  File "<frozen importlib._bootstrap_external>", line 1340, in _path_hooks
  File "<frozen importlib._bootstrap_external>", line 1610, in path_hook_for_FileFinder
  File "<frozen importlib._bootstrap_external>", line 1486, in __init__
FileNotFoundError: [Errno 2] No such file or directory



Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
[2]
Copy code
python_test(
   name = "integration_test",
   source = "integration_test.py",
   runtime_package_dependencies = [
      ":me", # (a docker image)
   ],
   tags = [
      "integration-test",
   ],
   environment = "__local__",
)