It looks like the different between maya -prompt and the mayapy standalone environment is that the event loop isn't started. mayapy does open the port and accept clients, but the client requests hang because they aren't being services.
Check this out. Start a request from your client, and then in your mayapy "server" process do this: import maya.utils as mu mu.processIdleEvents() Your client should get a reply :-) Looks like you will have to do the old pumpThread approach! On Fri Dec 05 2014 at 09:36:40 Paul Molodowitch <[email protected]> wrote: > Just wanted to confirm that I'm not doing something wrong, or that there > isn't something in our startup process that's making this fail... but is it > True that the commandPort command doesn't work if run from inside of > mayapy? (Note that it DOES work from "maya -prompt")... > > Here's the code I was using to test: > > To start: > > port = XXX > import pymel.core # just to startup maya > import maya.cmds as cmds > cmds.commandPort(n=":%s" % port, sourceType='python') > print "socket opened on port %s" % port > > > To connect: > > import socket > port = XXX > mayaSock = socket.socket() > mayaSock.settimeout(.5) > mayaSock.connect(('localhost', port)) > try: > mayaSock.send(r'print "hello from the outside world!\n";') > mayaSock.send(r'polyCube();') > finally: > mayaSock.close() > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CAAssL7Z4Y5R6EsNmFra9LkV%2BmmubTYXEnXa6JGaSBXjv8%2Bv_Bw%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAAssL7Z4Y5R6EsNmFra9LkV%2BmmubTYXEnXa6JGaSBXjv8%2Bv_Bw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3d6xxcob49Fsekpa97Cm9tCU6E8bYmqNyvUB%3DDXKNt2A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
