本文整理汇总了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)
示例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)
示例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()