如何在python中使用Socket打开软件

2024-04-26 07:54:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我知道socket是用来和服务器通信的,但是我能用socket和应用程序通信吗?你知道吗

我已在计算机中安装了maya软件。我想使用插座。是吗在python中使用socket打开软件是可能的吗?你知道吗


Tags: 服务器应用程序软件计算机socket插座maya
1条回答
网友
1楼 · 发布于 2024-04-26 07:54:31

在我给出示例代码之前。我应该警告你。不建议这样做。 如果您知道如何通过命令过程打开Maya软件,则可以尝试以下操作。你知道吗

command = "C:\\ProgramFiles\\Maya\\Maya.exe" #random command
output = subprocess.Popen(command, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
if output:
    output=str(output.stdout.read())
    print "Output:",output
    conn.sendall(output)

else:
    error=str(output.stderr.read())
    print "Error:",error
    conn.sendall(error)

相关问题 更多 >