Created
February 4, 2022 08:36
-
-
Save JustinPedersen/10af6b4a21eb522c1220f0229fe3149d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
HOST = '127.0.0.1' # the local host | |
PORT = 54321 # The same port as used by the server | |
ADDR = (HOST, PORT) | |
def send_command(): | |
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
client.connect(ADDR) | |
command = 'cmds.polyCube()' | |
message = command | |
client.send(str.encode(message)) | |
data = client.recv(1024) # receive the result info | |
client.close() | |
print(data) | |
if __name__ == '__main__': | |
# Run this within Maya to open the ports. The port can be any 5 digits | |
""" | |
import maya.cmds as cmds | |
cmds.commandPort(name=":54321", sourceType="python") | |
""" | |
send_command() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment