Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Query Google NotebookLM notebooks from Claude Code for source-grounded, citation-backed answers from Gemini.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/run.py
1#!/usr/bin/env python32"""3Universal runner for NotebookLM skill scripts4Ensures all scripts run with the correct virtual environment5"""67import os8import sys9import subprocess10from pathlib import Path111213def get_venv_python():14"""Get the virtual environment Python executable"""15skill_dir = Path(__file__).parent.parent16venv_dir = skill_dir / ".venv"1718if os.name == 'nt': # Windows19venv_python = venv_dir / "Scripts" / "python.exe"20else: # Unix/Linux/Mac21venv_python = venv_dir / "bin" / "python"2223return venv_python242526def ensure_venv():27"""Ensure virtual environment exists"""28skill_dir = Path(__file__).parent.parent29venv_dir = skill_dir / ".venv"30setup_script = skill_dir / "scripts" / "setup_environment.py"3132# Check if venv exists33if not venv_dir.exists():34print("๐ง First-time setup: Creating virtual environment...")35print(" This may take a minute...")3637# Run setup with system Python38result = subprocess.run([sys.executable, str(setup_script)])39if result.returncode != 0:40print("โ Failed to set up environment")41sys.exit(1)4243print("โ Environment ready!")4445return get_venv_python()464748def main():49"""Main runner"""50if len(sys.argv) < 2:51print("Usage: python run.py <script_name> [args...]")52print("\nAvailable scripts:")53print(" ask_question.py - Query NotebookLM")54print(" notebook_manager.py - Manage notebook library")55print(" session_manager.py - Manage sessions")56print(" auth_manager.py - Handle authentication")57print(" cleanup_manager.py - Clean up skill data")58sys.exit(1)5960script_name = sys.argv[1]61script_args = sys.argv[2:]6263# Handle both "scripts/script.py" and "script.py" formats64if script_name.startswith('scripts/'):65# Remove the scripts/ prefix if provided66script_name = script_name[8:] # len('scripts/') = 86768# Ensure .py extension69if not script_name.endswith('.py'):70script_name += '.py'7172# Get script path73skill_dir = Path(__file__).parent.parent74script_path = skill_dir / "scripts" / script_name7576if not script_path.exists():77print(f"โ Script not found: {script_name}")78print(f" Working directory: {Path.cwd()}")79print(f" Skill directory: {skill_dir}")80print(f" Looked for: {script_path}")81sys.exit(1)8283# Ensure venv exists and get Python executable84venv_python = ensure_venv()8586# Build command87cmd = [str(venv_python), str(script_path)] + script_args8889# Run the script90try:91result = subprocess.run(cmd)92sys.exit(result.returncode)93except KeyboardInterrupt:94print("\nโ ๏ธ Interrupted by user")95sys.exit(130)96except Exception as e:97print(f"โ Error: {e}")98sys.exit(1)99100101if __name__ == "__main__":102main()