Example #1
0
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
Example #2
0
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
Example #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
Example #4
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
Example #5
0
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