def SortDir(): sourcedir = "%s%s" % (sourcerepos, release) diroptions = glob.glob("%s" + "*") % (sourcedir) if not diroptions: print "No Directories contained a valid release of %s" % (release) # crap no matches elif len(diroptions) == 1: # exactly one match, use it... path = diroptions[0] else: # multiple options for n, v in enumerate(diroptions): print '[%d] %s' % (n, v) got = int(raw_input("Which? ")) path = diroptions[got] print 'using', path