Message 1 of 2
Run python via commandPort

Not applicable
08-04-2018
12:19 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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?