-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch_import_tool.sh
More file actions
55 lines (46 loc) · 1.88 KB
/
Copy pathlaunch_import_tool.sh
File metadata and controls
55 lines (46 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# MushLog Import Tool Launcher Script
# Automatically detects the correct Python command and launches the Import Tool
# Change to the directory where this script is located (handles symbolic links)
SCRIPT_PATH=$(readlink -f "$0" 2>/dev/null || echo "$0")
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
cd "$SCRIPT_DIR"
echo "📥 Launching MushLog Import Tool..."
# Detect the correct Python command to use
if [ -f "detect_python.py" ]; then
# Try to run the detection script with python first (better for pyenv)
if command -v python &> /dev/null; then
PYTHON_CMD=$(python detect_python.py 2>/dev/null | grep "Recommended command:" | cut -d: -f2 | xargs)
fi
# If that didn't work, try with python3
if [ -z "$PYTHON_CMD" ] && command -v python3 &> /dev/null; then
PYTHON_CMD=$(python3 detect_python.py 2>/dev/null | grep "Recommended command:" | cut -d: -f2 | xargs)
fi
fi
# Fallback detection if detection script didn't work
if [ -z "$PYTHON_CMD" ]; then
# Try commands in order of preference
for cmd in python python3 python3.11 python3.10 python3.9 python3.8 python3.7; do
if command -v $cmd &> /dev/null; then
# Test if it can import required modules
if $cmd -c "import sys, os, tkinter, sqlite3; print('Python {} at {}'.format(sys.version, sys.executable))" &> /dev/null; then
PYTHON_CMD=$cmd
break
fi
fi
done
fi
# Check if we found a working Python
if [ -z "$PYTHON_CMD" ]; then
echo "❌ Error: No working Python installation found."
echo "Please install Python 3.10 or higher."
echo ""
echo "If you're using pyenv, make sure it's properly configured:"
echo " pyenv install 3.11.0"
echo " pyenv global 3.11.0"
exit 1
fi
echo "✅ Using Python: $PYTHON_CMD"
# Launch Import Tool
echo "Starting Import Tool..."
$PYTHON_CMD run_import_tool.py