# Python Setup & IDE Guide Short, clear, Python‑focused. --- ## Requirements - **Python 3.10+** Uses pattern matching, modern type hints, async improvements. ```bash python --version ``` --- ## IDE Setup (PyCharm / IntelliJ) 1. **Set interpreter:** *File → Settings → Project → Python Interpreter → Select Python 3.10+* 2. **Fix syntax warnings:** *Editor → Inspections → Python → Set language level to 3.10+* 3. **Ensure correct SDK:** *Project Structure → Project SDK → Python 3.10+* --- ## Installation ```bash # Activate venv ~\venvs\scaev\Scripts\Activate.ps1 # Install deps pip install -r requirements.txt # Playwright browsers playwright install chromium ``` --- ## Database Configuration (PostgreSQL) The scraper now uses PostgreSQL (no more SQLite files). Configure via `DATABASE_URL`: - Default (baked in): `postgresql://auction:heel-goed-wachtwoord@192.168.1.159:5432/auctiondb` - Override for your environment: ```bash # Windows PowerShell $env:DATABASE_URL = "postgresql://user:pass@host:5432/dbname" # Linux/macOS export DATABASE_URL="postgresql://user:pass@host:5432/dbname" ``` Packages used: - Driver: `psycopg[binary]` Nothing is written to local `.db` files anymore. --- ## Verify ```bash python -c "import sys; print(sys.version)" python main.py --help ``` Common fixes: ```bash pip install playwright playwright install chromium ``` --- # Auto‑Start (Monitor) ## Linux (systemd) — Recommended ```bash cd ~/scaev chmod +x install_service.sh ./install_service.sh ``` Service features: - Auto‑start - Auto‑restart - Logs: `~/scaev/logs/monitor.log` ```bash sudo systemctl status scaev-monitor journalctl -u scaev-monitor -f ``` --- ## Windows (Task Scheduler) ```powershell cd C:\vibe\scaev .\setup_windows_task.ps1 ``` Manage: ```powershell Start-ScheduledTask "ScaevAuctionMonitor" ``` --- # Cron Alternative (Linux) ```bash crontab -e @reboot cd ~/scaev && python3 src/monitor.py 30 >> logs/monitor.log 2>&1 0 * * * * pgrep -f monitor.py || (cd ~/scaev && python3 src/monitor.py 30 >> logs/monitor.log 2>&1 &) ``` --- # Status Checks ```bash ps aux | grep monitor.py tasklist | findstr python ``` --- # Troubleshooting - Wrong interpreter → Set Python 3.10+ - Multiple monitors running → kill extra processes - PostgreSQL connectivity → verify `DATABASE_URL`, network/firewall, and credentials - Service fails → check `journalctl -u scaev-monitor` --- # Java Extractor (Short Version) Prereqs: **Java 21**, **Maven** Install: ```bash mvn clean install mvn exec:java -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install" ``` Run: ```bash mvn exec:java -Dexec.args="--max-visits 3" ``` Enable native access (IntelliJ → VM Options): ``` --enable-native-access=ALL-UNNAMED ``` --- --- This file keeps everything compact, Python‑focused, and ready for onboarding.