示例#1
0
# coding:utf-8

import os
import sys
from local import clogging as logging

logging.replace_logging()
logging.addLevelName(15, 'TEST', logging.COLORS.GREEN)

app_root = os.path.dirname(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
cert_dir = os.path.join(app_root, 'cert')
config_dir = os.path.join(app_root, 'config')
data_dir = os.path.join(app_root, 'data')
launcher_dir = os.path.join(app_root, 'launcher')
py_dir = os.path.join(app_root, 'python')
web_dir = os.path.join(app_root, 'web')
packages = os.path.join(py_dir, 'site-packages')

#自带 py 已经添加
if os.path.dirname(sys.executable) != py_dir:
    import glob
    #优先导入当前运行 py 已安装模块
    sys.path.append(packages)
    sys.path.extend(glob.glob('%s/*.egg' % packages))

try:
    import gevent
    import gevent.monkey
    gevent.monkey.patch_all(os=False,
                            signal=False,
示例#2
0
            ProxyOverride, reg_type = winreg.QueryValueEx(
                SETTINGS, 'ProxyOverride')
        except:
            ProxyOverride = None
        #导入默认代理例外地址
        if not ProxyOverride:
            winreg.SetValueEx(SETTINGS, 'ProxyOverride', 0, winreg.REG_SZ,
                              ProxyOverride)
    Popen((sys.executable, refresh_proxy))


from subprocess import Popen
from local import __version__ as gotoxver, clogging as logging

logging.replace_logging()
logging.addLevelName(15, 'TEST', logging._colors.GREEN)
_LOGLv = {
    0: logging.WARNING,
    1: logging.INFO,
    2: logging.TEST,
    3: logging.DEBUG
}

GotoX_app = None


def start_GotoX():
    global GotoX_app
    load_config()
    GotoX_app = Popen((sys.executable, app_start))
    os.environ['HTTPS_PROXY'] = os.environ['HTTP_PROXY'] = LISTEN_AUTO.http
示例#3
0
def replace_logging():
    import local.clogging as clogging
    clogging.replace_logging()
    clogging.addLevelName(15, 'TEST', clogging.COLORS.GREEN)
    clogging.preferredEncoding = 'cp936'