02-07-2020, 03:22 PM
Using RoboDK 4.0.1 on Mac...
robolink.py:922
I have to use Python2.7 as I'm calling RoboDK API from Maya, but `with socket` doesn't work with Python 2.7.
I changed to the code below and it seems to work.
robolink.py:922
I have to use Python2.7 as I'm calling RoboDK API from Maya, but `with socket` doesn't work with Python 2.7.
I changed to the code below and it seems to work.
Code:
elif ('/NEWINSTANCE' in self.ARGUMENTS or '-NEWINSTANCE' in self.ARGUMENTS):
from socket import socket
if sys.version_info.major == 3:
with socket() as s:
s.bind(('',0))
port = s.getsockname()[1]
print("Using available port %i" % port)
self.PORT_START = port
self.PORT_END = port
self.ARGUMENTS.append("-PORT=%i" % port)
else:
sock = socket()
sock.bind(('',0))
port = sock.getsockname()[1]
print("Using available port %i" % port)
self.PORT_START = port
self.PORT_END = port
self.ARGUMENTS.append("-PORT=%i" % port)
sock.close()