home *** CD-ROM | disk | FTP | other *** search
- do_again = 1;
-
- dir_choice = "../Scripts"
-
-
- import string
- import re
- import os
- import traceback
- import sys
- from os.path import join, getsize
- files = [];
-
- #sys.path.append("..\Scripts")
- #sys.path.append("..\Lib")
-
- while(do_again) :
-
- i = 0
- scripts = []
-
- root = dir_choice
- if(len(files) < 1) :
- files = os.listdir(dir_choice)
-
- for name in files:
- # if it ends in .JPG
- if (re.search("\.py\Z", string.lower(name)) > -1) :
- full_path = os.path.join(root, name)
-
- scripts.append(full_path);
-
- print i, ") ", name
- i = i + 1
-
-
-
- print "r) Enter script name"
- print "\nChoice >>>",
-
- choice = raw_input();
-
- if(choice != "") :
- if(choice.isalpha()) :
- if(choice.lower == "r") :
- print "Enter a script to run >>> ",
- script_name = raw_input();
- else :
- script_name = "";
- else :
- script_name = scripts[int(choice)]
-
- if(script_name and script_name != ""):
- try:
- execfile(script_name)
- except:
- print "Exception raised during script run:"
- print traceback.print_exc()
-
- print "Would you like to run another script? >>> ",
- choice = raw_input();
-
- if choice != 'y':
- do_again = 0
-