# Windows Python Tool Compat

> Experience notes on making POSIX-oriented Python tools work on Windows: which error means which cause, and the smallest fix that actually applies.

Windows Python Tool Compat is a free AI agent skill on Agensi by Drizzt Studio, in Testing & Debugging. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Drizzt Studio](https://www.agensi.io/creators/drizztstudio)
- Category: [Testing & Debugging](https://www.agensi.io/skills/testing-debugging)
- Version: 1.0
- Last updated: 2026-11-19
- Security: scan passed (2026-11-19); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/windows-python-tool-compat
- Tags: testing, documentation, windows, python, porting, compat, uv, msys

## About this skill

Experience note, not a download-and-run tool. It documents why external Python tools written for Linux/macOS fail on Windows, and which fix matches which error.

Failure modes covered: a stray PYTHONPATH entry that puts another venv's packages ahead of the tool's own (it surfaces as a pydantic_core import error, and the fix is removing the variable rather than reinstalling), module-level imports of POSIX-only stdlib names (termios, tty, pty, fcntl, pwd, grp), POSIX-only process handling (os.killpg, Popen(start_new_session=True)), OpenCV returning None on non-ASCII paths while PIL opens the same file fine, and third-party test suites that go red for environment reasons instead of project bugs.

How it works: run the tool with "env -u PYTHONPATH", scan the package for those six imports, place minimal stub modules whose functions raise NotImplementedError into that tool's own venv site-packages (never on PYTHONPATH), pull the signal code out into one helper that uses taskkill /T on Windows, and use an imdecode/imencode wrapper for non-ASCII paths. Authorization is a handoff, not automation: the user double-clicks a .cmd, completes OAuth in their own window, and the code never enters the chat.

Includes two reference files: a worked example of a MiniMax H3 Colab lane set up on Windows (with its honest verification record), and an appendix on cloud GPU quota, session lifecycle, terms-of-service routing and the authorization handoff.

Written for git-bash (MSYS) with native Windows Python, using uv tool installs, plain venvs, OpenCV and numpy. No scripts, test suite, or automated patcher is bundled. Apply the steps to your own tool and verify them yourself.

## Requires

- git-bash (MSYS)
- Native Windows Python
- Python
- Git
- Optional: uv (Python tool runner)
- Optional: OpenCV + numpy

Knowledge document, not a tool: no scripts bundled. Maps each Windows failure to its fix (PYTHONPATH collision, POSIX-only modules, os.killpg, OpenCV non-ASCII paths) and includes a MiniMax H3 Colab example with its real limits: OAuth verified only to the authorization URL, no full end-to-end run.

## Known limitations

Knowledge document only: no scripts, no test suite, no automated patcher. You apply the patterns to your own tool.
Not validated end-to-end against any specific tool in the public version; the paths, tool names and constant values in the example are placeholders.
Stubs and code patches are overwritten by "uv tool upgrade" / reinstall, and by git pull in a cloned repo.
POSIX behaviour is not emulated by design: stubbed functions raise NotImplementedError, so a code path that genuinely needs a terminal will stop with an error rather than work.
"--help" passing does not prove the rest of the package imports; verify with a command that reaches the code you need.
Authorization is a handoff, not automation: the account owner completes it in their own window. In the worked example it was verified only up to the printed authorization URL; token persistence was not exercised.
Written for git-bash (MSYS) with native Windows Python. cmd.exe, PowerShell and WSL were not the target environment.
The reference example's own offline test suite ran 8 tests, 4 pass / 4 fail; all four failures were POSIX-exec harness issues, not project bugs.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Windows Python Tool Compat skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this differ from just running my Python tools inside Docker or WSL?

Docker and WSL hand you a full Linux userland. This does the opposite trade: keep native Windows Python and remove the specific POSIX dependencies that block the import — a PYTHONPATH entry, module-level imports, an os.killpg call, an OpenCV path. That is cheaper when the tool trips on a handful of those and nothing else. If the tool genuinely needs POSIX exec, real process groups or a POSIX filesystem, use WSL: a stub raises NotImplementedError, it does not emulate anything.

### What exactly is included?

This listing is free. You get documentation, not code: SKILL.md plus two reference files. SKILL.md is the error-to-fix map — PYTHONPATH collisions, POSIX-only stdlib modules, POSIX process arguments, OpenCV on non-ASCII paths, and how to tell an environment-only test failure from a project bug. One reference is a worked example of a MiniMax H3 Colab lane built on Windows; the other is an appendix on cloud GPU quota, session lifecycle, terms-of-service routing and the authorization handoff. There are no scripts, no patcher and no test suite.

### Does this work with modern package managers like uv?

uv is the primary path — the worked example is a "uv tool install --python 3.12" CLI, and the stubs go into that tool's own site-packages under %APPDATA%\uv\tools\<tool>\Lib\site-packages. Two caveats: a reinstall or "uv tool upgrade" overwrites those stubs, and plain venvs use the same technique but were not exercised in the public version.

### Will these fixes slow my tools down?

No performance claim is made, and nothing here wraps your interpreter or adds a runtime layer. The stubs are small modules whose functions raise, so they cost nothing on paths you never reach. The OpenCV helper reads the file into a numpy buffer and decodes it — one extra copy compared with cv2.imread, no benchmark measured — and it exists because cv2.imread returns None on non-ASCII paths, not because it is faster.

### What happens to the fixes when I update my packages?

They stay until the package is reinstalled. "uv tool upgrade" or a reinstall replaces that tool's site-packages, and git pull overwrites edited files in a cloned repo, so the stub or patch disappears. Keep a note of the files you added and re-apply after each upgrade; re-running the Step 1 scan shows whether the imports still need stubs.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
