#!/usr/local/bin/python2.7

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]
    except NameError:
        # py2exe
        runningDir=os.path.dirname(sys.argv[0])
        modDir=runningDir

    # set up paths for local development
    sys.path.insert(0, os.path.join(modDir, "libanki"))
    sys.path.insert(0, os.path.join(os.path.join(modDir, ".."), "libanki"))

    import ankiqt

    try:
        import ankiqt.forms
    except ImportError:
        raise Exception("You need to run tools/build_ui.sh in order for anki to work.")

    ankiqt.run()
