Run python via commandPort

Run python via commandPort

Anonymous
Not applicable
675 Views
1 Reply
Message 1 of 2

Run python via commandPort

Anonymous
Not applicable

I'm trying run python script via commandPort.

Connection is OK, but I have problem on python namespace.

import socket

BUFSIZE = 4096
PORT = 7720 def send(sock, s): sock.send(s) recv = sock.recv(BUFSIZE) if recv : print(recv) sock = socket.create_connection(('127.0.0.1', PORT)) send(sock, 'import pymel.core as pm') send(sock, 'pm.ls()') sock.close()

This returns "name 'pm' is not defined"

It is OK when i run this on script editor directly.
How can i solve this?

0 Likes
676 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

I am using Visual Studio Code with a Maya Extension and it works fine. Hope this helps.

0 Likes