AI Agent Hub
Back to plugins
🖥️

dsh-python-tempfile-shim

Client Updated 2026.08.25

Run the following command in DeepSeek Harness:

dsh plugin install AngelosZou/dsh-python-tempfile-shim

Paste the following prompt into your AI chat to install this plugin:

Clone https://github.com/AngelosZou/dsh-python-tempfile-shim to a local directory, then run dsh plugin install AngelosZou/dsh-python-tempfile-shim from that directory to install the plugin.

About this plugin

When running Python inside the DSH Windows sandbox (workspace-write mode), CPython creates temporary directories with a 0o700 ACL that grants only owner access. Because the sandbox WRITE_RESTRICTED token excludes the user own SID from the restricting list, the confined process cannot read or write the directories it just created, and pytest tmp_path tests immediately fail with PermissionError (WinError 5). dsh-python-tempfile-shim plugs this gap until an upstream fix ships.

The plugin injects PYTHONPATH at the shell executor resolve layer, so every confined command automatically picks up a lightweight sitecustomize.py shim. That shim makes os.mkdir ignore the mode argument, letting new directories inherit the parent folder ACL which already carries the sandbox workspace and temp write ACEs, instead of CPython owner-only DACL. The fix transparently covers python, pytest, pip, tox, nox, venvs, and all child processes, with no extra tools, environment variables, or model context required, and it leaves the sandbox token, ACEs, and policy boundary completely untouched.

It is intended for anyone running Python development or test suites inside the DSH Windows sandbox. Keep in mind this is a stopgap: once DSH ships its upstream fix, uninstall the plugin, since 0o700 is CPython privacy hardening that unconfined processes should retain.

Use Cases

  • pytest tmp_path tests fail with WinError 5 inside the DSH Windows workspace-write sandbox
  • tempfile.mkdtemp or os.makedirs(mode=0o700) throws PermissionError under the confined token
  • tox or nox suites break because child processes cannot write to temp directories in the sandbox

Best For

  • Developers running Python workloads inside the DSH Windows sandbox
  • Engineers who rely on pytest tmp_path or TemporaryDirectory for integration tests
  • Users debugging Python file-permission issues under a restricted workspace