run_setup: defer psycopg2 import so --help works without it
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
eed06559c0
commit
6dde987cfb
1 changed files with 7 additions and 2 deletions
|
|
@ -28,8 +28,6 @@ import argparse
|
|||
from pathlib import Path
|
||||
from typing import Dict
|
||||
|
||||
import psycopg2
|
||||
|
||||
SQL_DIR = Path(__file__).parent / "sql"
|
||||
CONFIG_FILE = Path(__file__).parent / "db_config.json"
|
||||
|
||||
|
|
@ -150,6 +148,13 @@ def main() -> int:
|
|||
p.add_argument("--yes", action="store_true", help="Skip confirmation prompts")
|
||||
args = p.parse_args()
|
||||
|
||||
try:
|
||||
import psycopg2
|
||||
except ModuleNotFoundError:
|
||||
print("[FAIL] psycopg2 not installed. Run inside an environment that has "
|
||||
"it (e.g. the TSAPI_SERIESDB_PG_PY venv), or: pip install psycopg2-binary")
|
||||
return 1
|
||||
|
||||
cfg = load_config(args)
|
||||
|
||||
print("=" * 70)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue