def getsubdirs(dir): if (not os.path.isdir(dir)): raise IOError, 'getsubdirs() requires a directory' files = os.listdir(dir) dirsonly = [] for f in files: #print("%s\n" % os.path.join(dir, f)) if (os.path.isdir(os.path.join(dir, f))): dirsonly.append(f) return dirsonly