コード例 #1
0
ファイル: cmdline.py プロジェクト: nathancahill/hy
def run_command(source):
    try:
        import_buffer_to_module("__main__", source)
    except LexException as exc:
        # TODO: This would be better if we had line, col info.
        print(source)
        print(repr(exc))
        return 1
    return 0
コード例 #2
0
ファイル: cmdline.py プロジェクト: kaizoku/hy
def run_command(source):
    try:
        import_buffer_to_module("__main__", source)
    except LexException as exc:
        # TODO: This would be better if we had line, col info.
        print(source)
        print(repr(exc))
        return 1
    return 0
コード例 #3
0
def run_command(source):
    try:
        import_buffer_to_module("__main__", source)
    except (HyTypeError, LexException) as e:
        if SIMPLE_TRACEBACKS:
            sys.stderr.write(str(e))
            return 1
        raise
    except Exception:
        raise
    return 0
コード例 #4
0
ファイル: cmdline.py プロジェクト: khinsen/hy
def run_command(source):
    try:
        import_buffer_to_module("__main__", source)
    except (HyTypeError, LexException) as e:
        if SIMPLE_TRACEBACKS:
            sys.stderr.write(str(e))
            return 1
        raise
    except Exception:
        raise
    return 0
コード例 #5
0
ファイル: cmdline.py プロジェクト: unmerged/hy
def run_command(source):
    try:
        if not PY3:
            # TODO: Encoding type should depend on locale.
            source = source.decode('utf-8')
        import_buffer_to_module("__main__", source)
    except (HyTypeError, LexException) as e:
        if SIMPLE_TRACEBACKS:
            sys.stderr.write(str_type(e))
            return 1
        raise
    except Exception:
        raise
    return 0