Пример #1
0
def checkEmbedPython():
    global useEmbedPython
    useEmbedPython = True
    if (isXP() or is2003() or (systeminfo == "")):
        useEmbedPython = False
        return
    y_bin = bridge.pn(bridge.pjoin(bridge.get_root_path(), './printok.py'))
    try:
        py_bin = bridge.pn(bridge.pjoin(bridge.get_root_path(), EMBED_PYTHON))
    except:
        useEmbedPython = False
        return
    args = [py_bin, y_bin]
    logging.info(args)
    PIPE = subprocess.PIPE
    try:
        p = subprocess.Popen(args, stdout=PIPE, stderr=PIPE, shell=False)
    except:
        useEmbedPython = False
        return
    stdout, stderr = p.communicate()
    stdout = bridge.try_decode(stdout)
    stderr = bridge.try_decode(stderr)
    logging.info(stdout)
    if "ok" not in stdout:
        useEmbedPython = False
Пример #2
0
def get_systeminfo():
    try:
        args = bridge.pn(bridge.pjoin(bridge.get_root_path(), "./SysArch.exe"))
        PIPE = subprocess.PIPE
        p = subprocess.Popen(args, stdout=PIPE, stderr=PIPE, shell=False)
        stdout, stderr = p.communicate()
        stdout = bridge.try_decode(stdout)
        stderr = bridge.try_decode(stderr)
        global systeminfo
        systeminfo = stdout
    except:
        systeminfo = ""
Пример #3
0
def get_systeminfo():
    try:
        args = "systeminfo"
        PIPE = subprocess.PIPE
        p = subprocess.Popen(args, stdout=PIPE, stderr=PIPE, shell=False)
        stdout, stderr = p.communicate()
        stdout = bridge.try_decode(stdout)
        stderr = bridge.try_decode(stderr)
        global systeminfo
        systeminfo = stdout
    except:
        systeminfo = ""
Пример #4
0
 def _run_you(self,arg):
     y_bin = bridge.pn(bridge.pjoin(bridge.get_root_path(), conf.bin_you_get))
     py_bin = sys.executable
     args = [py_bin, y_bin] + arg
     PIPE = subprocess.PIPE
     print(args)
     p = subprocess.Popen(args, stdout=PIPE, stderr=PIPE, shell=False)
     stdout, stderr = p.communicate()
     # try to decode
     stdout = bridge.try_decode(stdout)
     stderr = bridge.try_decode(stderr)
     #print(stdout)
     return stdout, stderr
Пример #5
0
 def _run(self, arg, need_stderr=False):
     y_bin = bridge.pn(bridge.pjoin(bridge.get_root_path(), self.bin))
     py_bin = sys.executable
     if "PyRun.exe" in py_bin:
         args = [py_bin, '--normal', y_bin]
     else:
         args = [py_bin, y_bin]
     args = args + arg
     PIPE = subprocess.PIPE
     logging.debug(args)
     p = subprocess.Popen(args, stdout=PIPE, stderr=PIPE if need_stderr else None, shell=False)
     stdout, stderr = p.communicate()
     # try to decode
     stdout = bridge.try_decode(stdout)
     stderr = bridge.try_decode(stderr) if need_stderr else None
     # print(stdout)
     return stdout, stderr