# Python Exec

> Execute arbitrary Python code and return stdout. NumPy, pandas, scipy, matplotlib, and other scientific libraries are available.

- Skill: `lamm-mit/python-exec` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add lamm-mit/python-exec`
- Raw SKILL.md: https://api.skillmd.com/api/skills/lamm-mit/python-exec/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Data & Analytics
- Author: lamm-mit (https://skillmd.com/u/lamm-mit)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/lamm-mit/python-exec

---


# python-exec

Execute a Python code snippet in a subprocess and return its stdout output.

## Usage

```bash
python3 scripts/python_exec.py --code "import numpy as np; print(np.mean([1,2,3]))"
```

## Output

Returns stdout from the executed code (up to 8000 chars). If execution fails, returns stderr prefixed with `[stderr]:`.

## Available libraries

NumPy, pandas, scipy, matplotlib, scikit-learn, biopython, rdkit, and any other package installed in the environment.

