hy/bin/hython

34 lines
832 B
Plaintext
Raw Normal View History

2012-12-18 19:02:50 -05:00
#!/usr/bin/env python
2012-12-18 19:24:10 -05:00
# -*- coding: utf-8 -*-
2012-12-18 19:02:50 -05:00
from hy.lang.importer import _hy_import_file
2012-12-18 19:24:10 -05:00
from code import InteractiveConsole
2012-12-29 10:56:45 -05:00
import traceback
2012-12-18 19:02:50 -05:00
import sys
2012-12-29 10:56:45 -05:00
2012-12-28 17:57:16 -05:00
try:
import readline
except ImportError:
pass
2012-12-18 19:02:50 -05:00
2012-12-18 19:24:10 -05:00
if len(sys.argv) > 1:
2012-12-18 23:44:44 -05:00
sys.argv = sys.argv[1:]
2012-12-29 10:56:45 -05:00
try:
mod = _hy_import_file(sys.argv[0], '__main__')
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
ntb = exc_traceback.tb_next.tb_next.tb_next # YUCK.
raise type(e), None, ntb
2012-12-18 19:24:10 -05:00
sys.exit(0)
InteractiveConsole().interact(banner="""
"Really, if the lower orders dont set us a good example, what on
earth is the use of them?"
-- Oscar Wilde (The Importance of Being Earnest)
The hython bits have been loaded -- magically, .hy
files are importable!""")