def processdir(dir, listnames):
    try:
        names = os.listdir(dir)
    except os.error, msg:
        sys.stderr.write("Can't list directory: %s\n" % dir)
        return 1
    files = []
    for name in names:
        fn = os.path.join(dir, name)
        if os.path.normcase(fn).endswith(".py") or os.path.isdir(fn):
            files.append(fn)
    files.sort(lambda a, b: cmp(os.path.normcase(a), os.path.normcase(b)))
    exit = None
    for fn in files:
        x = process(fn, listnames)
        exit = exit or x
    return exit
dataset/ETHPy150Open Southpaw-TACTIC/TACTIC/src/context/client/tactic-api-python-4.0.api04/Tools/Scripts/finddiv.py/processdir/original