当前位置: 首页>>代码示例>>Python>>正文


Python Universals.trEncodeList方法代码示例

本文整理汇总了Python中Core.Universals.trEncodeList方法的典型用法代码示例。如果您正苦于以下问题:Python Universals.trEncodeList方法的具体用法?Python Universals.trEncodeList怎么用?Python Universals.trEncodeList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core.Universals的用法示例。


在下文中一共展示了Universals.trEncodeList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: execute

# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import trEncodeList [as 别名]
def execute(_command=[], _executableName=None):
    if _executableName in ["HamsiManager", "HamsiManagerInstaller"]:
        pathOfExecutable = findExecutablePath(_executableName)
        if pathOfExecutable.find(".py") > -1 or pathOfExecutable.find(".py3") > -1 or pathOfExecutable.find(".pyw") > -1:
            pathOfExecutable = [getPythonPath(), pathOfExecutable]
        else:
            pathOfExecutable = [pathOfExecutable]
        _command = pathOfExecutable + _command
    if len(_command) > 1 and _command[1][0] is not "-" and _command[0].find("kdesu") > -1:
        tCommand = _command[0]
        del _command[0]
        for c in _command:
            if c.find(" ") > -1 or c.find("'") > -1:
                c = "'" + c + "'"
        tCommand += " \"" + (" ".join(_command)) + "\""
        _command = tCommand
        Records.add("Execute >>> " + str(_command))
        Records.saveAllRecords()
        return subprocess.Popen(args=uni.trEncode(_command, fu.fileSystemEncoding), stdin=subprocess.PIPE, stdout=subprocess.PIPE, bufsize=1, shell=True)
    else:
        Records.add("Execute >>> " + str(_command))
        Records.saveAllRecords()
        try: correctedCommand = uni.trEncodeList(_command, fu.fileSystemEncoding)
        except: correctedCommand = _command
        return subprocess.Popen(args=correctedCommand, stdin=subprocess.PIPE, stdout=subprocess.PIPE, bufsize=1)
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:27,代码来源:Execute.py

示例2: openWith

# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import trEncodeList [as 别名]
def openWith(_command):
    if uni.isWindows:
        Records.add("Open With >>> " + str(_command))
        try: _command = uni.trEncodeList(_command, fu.fileSystemEncoding)
        except: _command = _command
        correctedCommand = ""
        for x, commandPart in enumerate(_command):
            if x > 0: correctedCommand += " "
            correctedCommand += commandPart
        return os.startfile(correctedCommand)
    else:
        _command = ["xdg-open"] + _command
        Records.add("Open With >>> " + str(_command))
        try: correctedCommand = uni.trEncodeList(_command, fu.fileSystemEncoding)
        except: correctedCommand = _command
        return subprocess.Popen(correctedCommand)
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:18,代码来源:Execute.py

示例3: getCommandResult

# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import trEncodeList [as 别名]
def getCommandResult(_command, _cwd=None):
    if uni.isWindows:
        _command = ["start"] + _command
    Records.add("Execute >>> " + str(_command))
    try: correctedCommand = uni.trEncodeList(_command, fu.fileSystemEncoding)
    except: correctedCommand = _command
    if _cwd is not None:
        myPopen = subprocess.Popen(correctedCommand, stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True,
                                   cwd=_cwd)
    else:
        myPopen = subprocess.Popen(correctedCommand, stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
    po, pi = myPopen.stdin, myPopen.stdout
    po.close()
    return pi.read()
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:16,代码来源:Execute.py


注:本文中的Core.Universals.trEncodeList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。