Windows Python Tool Compat

    by Drizzt Studio

    1

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

    Free

    Security scanned

    Works with the AI Agents you already use

    Windows Python Tool Compat

    Example session with this skill installed

    I installed a Python CLI with uv tool install on Windows, but even "--help" fails with ModuleNotFoundError: No module named 'termios'. I only need the non-interactive commands — how do I get past this?

    • Read your context and instructions
    • Compiled the windows python tool

    [Illustrative walkthrough: the tool name, user name and the constant values below are placeholders, and nothing here was measured on your machine.]

    termios is a POSIX-only stdlib module; Windows does not ship it, so the import fails. The detail that decides your fix is where it is imported: if the hit sits at the top of a module that "--help" loads, the CLI dies before argument parsing — which is why the help command fails even though you never intend to touch the interactive console.

    Step 1 — scan before you patch. Check all six POSIX-only names in one pass, not one error at a time:

    grep -rn "^import \(termios\|tty\|pty\|fcntl\|pwd\|grp\)" "C:/Users/<user>/AppData/Roaming/uv/tools/<tool>/Lib/site-packages/<pkg>" --include=*.py
    

    Step 2 — add a minimal stub to that tool's own site-packages. Create the file "C:/Users/<user>/AppData/Roaming/uv/tools/<tool>/Lib/site-packages/termios.py":

    # termios.py — minimal stub, only the names your package imports
    # Values are illustrative placeholders; they do not matter here because every function raises.
    TCSANOW = 0
    TCSADRAIN = 1
    TCSAFLUSH = 2
    ICANON = 0
    ECHO = 0
    
        def tcgetattr(fd):
            raise NotImplementedError("termios is POSIX-only")
    
        def tcsetattr(fd, when, attrs):
            raise NotImplementedError("termios is POSIX-only")
    

    Deliberately raise instead of doing nothing: a silent no-op lets the tool continue in a state that is wrong in a way you cannot see. Any other name your package imports needs the same treatment.

    Do not put this on PYTHONPATH. termios is a stdlib name, so putting it on PYTHONPATH shadows it for every Python process that inherits the variable, including your own tooling. The stub lives in that one tool's site-packages and nowhere else.

    Step 3 — verify, and be honest about what the check proves:

    env -u PYTHONPATH <tool> --help
    

    "--help" passing only proves that this import path works on this machine; it is not proof that every module imports cleanly. Run one command that actually reaches the code you need (a real subcommand, not the help screen), or check the modules directly:

    env -u PYTHONPATH python -c "import <pkg>.<mod>"
    

    Step 4 — expect company. Where termios appears, tty usually follows. The Step 1 scan already told you whether pty, fcntl, pwd or grp are there too; fix them in the same round.

    Step 5 — write it down. A reinstall or "uv tool upgrade" overwrites that tool's site-packages, so the stub goes with it, and a cloned repo loses the patch on git pull. Record which files you added so you can re-apply them after a reinstall. If you hit the NotImplementedError at runtime, that path really needs terminal behaviour — use a native Windows alternative instead of treating the stub as a fix.

    Connects securely to your tools. The creator never sees your data.

    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.

    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

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 16 days ago

    • Free with an Agensi account

    Software
    GitNative Windows PythonPython
    Optional
    uv (Python tool runner)OpenCVnumpy

    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.

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Network Access
    Listed16 days ago

    What's inside

    Frequently Asked Questions

    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.

    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.

    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.

    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.

    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.

    New in Testing & Debugging

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.

    Free