Exemplo n.º 1
0
        raise W.AlertError, detail
    except (KeyboardInterrupt, BdbQuit):
        pass
    except SystemExit, arg:
        if arg.code:
            sys.stderr.write("Script exited with status code: %s\n" % repr(arg.code))
    except:
        if debugging:
            sys.settrace(None)
            PyDebugger.postmortem(sys.exc_type, sys.exc_value, sys.exc_traceback)
            return
        else:
            tracebackwindow.traceback(1, filename)
    if debugging:
        sys.settrace(None)
        PyDebugger.stop()


_identifieRE = re.compile(r"[A-Za-z_][A-Za-z_0-9]*")

def identifieRE_match(str):
    match = _identifieRE.match(str)
    if not match:
        return -1
    return match.end()

def _filename_as_modname(fname):
    if fname[-3:] == '.py':
        modname = fname[:-3]
        match = _identifieRE.match(modname)
        if match and match.start() == 0 and match.end() == len(modname):