move python check into libanki

This commit is contained in:
Damien Elmes 2011-04-16 10:35:30 +09:00
parent 7de4552b0e
commit 0eb56c27f9

9
anki
View file

@ -1,10 +1,7 @@
#!/usr/bin/env python
import os, sys
if __name__ == "__main__":
if sys.version_info[0] > 2:
raise Exception("Anki should be run with python2.x.")
try:
modDir=os.path.dirname(os.path.realpath(__file__))
runningDir=os.path.split(modDir)[0]
@ -12,15 +9,11 @@ if __name__ == "__main__":
# py2exe
runningDir=os.path.dirname(sys.argv[0])
modDir=runningDir
sys.path.insert(0, os.path.join(modDir, "libanki"))
sys.path.insert(0, os.path.join(os.path.join(modDir, ".."), "libanki"))
import aqt
try:
import aqt.forms
except ImportError:
raise Exception("You need to run tools/build_ui.sh in order for anki to work.")
raise Exception("Please read README.development.")
aqt.run()