jonathan.pgagne Posted November 2, 2016 Share Posted November 2, 2016 Hey guys, I saw there is a hscript command ‘openport’, but I didn't find example on how to communicate with houdini via python. Here's what I need to do: 1-Open a port, from localHost, within houdini session. 2-From an external python interpreter, execute houdini python commands, using local port. IE: hou.node('/obj').createNode('geo') Here's how I can do this in maya: 1-cmds.commandPort(name='localhost:7555') 2- client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client.connect(('127.0.0.1', 7555)) c = ‘python(“cmds.polySphere()”);’ client.send(c) Does anyone know if it's possible to this in houdini? Anyone has some examples? Thanks Jonathan Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted January 2, 2017 Share Posted January 2, 2017 Exactly the same would be in Houdini: def houdini_send(msg): import socket HOST = "localhost" PORT = 12100 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) s.send(msg + '\n') res = s.recv(1024) s.close() return res But consider using hrpyc instead for general interaction. http://www.sidefx.com/docs/houdini/hom/rpc Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.