#!/bin/bash # Debugging launch script for the tkinter player application # Set working directory to script location cd "$(dirname "$0")" # Activate the virtual environment if it exists if [ -d "venv" ]; then source venv/bin/activate echo "Virtual environment activated" else echo "Warning: No virtual environment found, using system Python" fi # Set environment variables for better display on Raspberry Pi export DISPLAY=${DISPLAY:-:0.0} export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/tmp/runtime-pi} # Change to the signage_player directory cd signage_player # Run the main application with full error output echo "Starting tkinter player..." echo "Working directory: $(pwd)" echo "Python path: $(which python3)" echo "Display: $DISPLAY" # Run with error logging python3 main.py 2>&1 | tee ../main_data/app_debug.log # Capture exit code EXIT_CODE=$? # Deactivate virtual environment when done if [ -d "../venv" ]; then deactivate fi echo "Application exited with code: $EXIT_CODE" exit $EXIT_CODE