The trunk can use the main server again (for the time being).
[switzerland.git] / switzerland-client
blobc5fdb2220ef4800177254daf97169eeaeb3ce062
1 #!/usr/bin/env python
3 import sys
4 import os,os.path
6 def check_version():
7 if sys.version_info < (2,4,0):
8 # This is a bad start, but let's see if there is a python2.4 around:
9 backup_plan = False
10 if "PATH" in os.environ:
11 for dir in os.environ["PATH"].split(os.pathsep):
12 if os.path.exists(dir + os.sep + "python2.4"):
13 backup_plan = True
15 if not backup_plan:
16 print "Unfortunately you need Python 2.4 or later to run Switzerland."
17 print "Please install Python 2.4+"
18 print "(or send us a patch so that Switzerland runs with your version of Python ;)"
19 sys.exit(1)
20 else:
21 print "It looks like Python2.4 is installed on your system, but it is not the"
22 print 'default Python version. Try running switzerland using "python2.4" '
23 print 'instead of "python"'
24 sys.exit(0)
27 check_version()
28 try:
29 from switzerland.client import Alice
30 except ImportError:
31 import sys
32 sys.path.append('/usr/local/lib/python2.5/site-packages/')
33 sys.path.append('/usr/lib/python2.5/site-packages/')
34 sys.path.append('.')
36 try:
37 from switzerland.client import Alice
38 except ImportError, ie:
39 print >> sys.stderr, \
40 ie.message
41 print >> sys.stderr, \
42 'Error: cannot load client. Please check your $PYTHONPATH.'
43 sys.exit(1)
45 try:
46 Alice.main()
47 except KeyboardInterrupt:
48 pass