From bce42dd29790554a555e9a19b7bfb7d1ec2bda7a Mon Sep 17 00:00:00 2001 From: jdoe0 Date: Sat, 4 Jan 2014 19:58:44 +0700 Subject: [PATCH] ankisyncd.sh: Check python version and look for python2 if it's not the default python --- ankisyncd.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ankisyncd.sh b/ankisyncd.sh index bf34703..75981c6 100755 --- a/ankisyncd.sh +++ b/ankisyncd.sh @@ -1,5 +1,16 @@ #! /usr/bin/env bash export PYTHONPATH="/usr/share/ankisyncd" +export PYTHON="python" -python2 /usr/share/ankisyncd/ankisyncd/sync_app.py +if [ $(python -V 2>&1 | cut -d ' ' -f 2 | cut -d '.' -f 1) -ne 2 ]; then + which python2 > /dev/null + + if [ $? -eq 0 ]; then + PYTHON="python2" + else + echo "$0: Cannot find Python 2" 1>&2 + fi +fi + +$PYTHON /usr/share/ankisyncd/ankisyncd/sync_app.py