35 lines
787 B
Python
35 lines
787 B
Python
#!/usr/bin/env python3
|
|
import sys
|
|
|
|
oldexcepthook = sys.excepthook
|
|
def newexcepthook(type,value,traceback):
|
|
oldexcepthook(type,value,traceback)
|
|
#input("Press ENTER to quit.")
|
|
sys.excepthook = newexcepthook
|
|
|
|
import os
|
|
p = os.path.join
|
|
pUp = os.path.dirname
|
|
s = False
|
|
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
|
|
s = os.path.realpath(sys.executable)
|
|
else:
|
|
s = os.path.realpath(__file__)
|
|
sp = pUp(s)
|
|
|
|
# script start
|
|
def oxiRunCode(str, lcs = False, description = "loose-code"):
|
|
if lcs == False: lcs = {}
|
|
code = compile(str,description,"exec")
|
|
exec(code,globals(),lcs)
|
|
return lcs
|
|
|
|
def oxiRunScript(sf,lcs = False):
|
|
if lcs == False: lcs = {}
|
|
with open(sf) as script:
|
|
oxiRunCode(script.read(),lcs,sf)
|
|
return lcs
|
|
|
|
def main():
|
|
oxiRunScript(p(sp,"main.py"))
|
|
main() |