# coding: utf-8
# 2011-07-09 windwiny
# 通用 python源程序 包装程序。
# 自定义: 修改 python 安装路径、 __run_cmd 函数
# 注意:需要在 sys.path 中加入 python 安装路径后才能使用 import
def __run_cmd(*args):
print ' ---> ---------------- run begin ----------------'
import UliPad
UliPad.App()
print ' ---> ---------------- run end ----------------'
print
def run(*args):
try:
import sys
print ' -> OLD sys.path:', sys.path
sys.path += [
'f:\\ux\\python26',
'f:\\ux\\python26\\lib',
'f:\\ux\\python26\\DLLs',
'f:\\ux\\python26\\lib\\site-packages',
'f:\\ux\\python26\\lib\\site-packages\\wx-2.8-msw-unicode'
]
import traceback
import os
pgdir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, pgdir)
print ' -> NEW sys.path:', sys.path
print
print ' -> ORI __file__:', __file__
print ' -> ABS __file__:', os.path.abspath(__file__)
print
print ' -> OLD os.getcwd:', os.getcwd()
os.chdir(pgdir)
print ' -> NEW os.getcwd:', os.getcwd()
print
if not hasattr(sys, 'argv'):
sys.argv = []
print ' -> OLD sys.argv:', sys.argv
for i in args:
sys.argv.append(i)
sys.argv.insert(0, '.')
print ' -> NEW sys.argv:', sys.argv
print
__run_cmd()
except SystemExit:
print ' -> SystemExit'
except KeyboardInterrupt:
print ' -> KeyboardInterrupt'
except ImportError as ee:
print ' -> ', ee
print
print ' sys.path not has python and wxpython path ? '
print
print traceback.format_exc()
print
except Exception as ee:
print ' ->>> -------- UliPad except --------'
print ee
print traceback.format_exc()
print ' ->>> -------- except end --------'
if __name__ == '__main__':
print
print ' This is a wrap file. '
print