Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

Not able to run python in a sandbox on Windows #16

Description

@mariusp12

Hello,

when trying to run a simple example of creating a sandbox and executing a piece of code inside, I get an error on Windows. For UNIX-based systems, everything works fine:

    async with  code_sandbox(dependencies=['matplotlib', 'pandas'], allow_networking=False) as sandbox:
        return await sandbox.eval("1+1")

The error that I get is:

    raise RuntimeError(f'`deno run ...` returned a non-zero exit code {p.returncode}: {"".join(stdout)}')
RuntimeError: `deno run ...` returned a non-zero exit code 1: error: Module not found "file:///C:/WINDOWS/src/main.ts".

By looking at the code, when running deno with a relative path, the base path seems not to be resolved correctly on Windows. Also, I tried setting the correct path manually in the lib, however, then I ran into another error, also related to the relative path of the node_modules (basically there seems to be a problem is in this code:

def _deno_install_args(dependencies: list[str] | None = None) -> list[str]:
    args = [
        'run',
        '--allow-net',
        '--allow-read=./node_modules',
        '--allow-write=./node_modules',
        '--node-modules-dir=auto',
        'src/main.ts',
        'noop',
    ]

)

I suppose the easiest way would be to allow the paths to be configurable?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions