Hello,
I am currently writing a little external application with python in order to be able to communicate with Maya to retrieve information such as the current opened project name, the frame start and end frame to render, stuff like that.
Since now, establishing a connection with commandPort on the Maya side and telnet or socket on the python side is fine. I can send mel or python commands just fine but never do I receive anything back from Maya except for “None” and ([] or square). Actually yes, I get all the error messages and the commands if I set echoOutput=True.
Anyone has an idea about what’s wrong?
Huge thanks!
Maya 2014 (python 2.7)
MacPro – Yosemite
python 3.5, PyQt 5, Qt 5.5 and PyCharm 5
Maya:
import maya.cmds as mc
mc.commandPort(name=“127.0.0.1:7777”, ,echoOutput=True, sourceType=“python”)
Pycharm
maya = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
maya.connect((“127.0.0.1”, 7777))
message = bytes(“import maya.cmds as mc;mc.file(query=True,sceneName=True)”, “utf-8”)
maya.write(message)
data = maya.recv(4096)
stringData = data.decode(“utf-8”, “ignore”)
print (‘The Result is: %s’%stringData)
maya.close()
The Result is: None