Posts: 2
Threads: 1
Joined: Jan 2019
Reputation:
2
Hello,
I think there is a bug, on Linux with the latest RoboDK version, in the RoboDK / bin folder, unable to run RoboDK
Only RoboDK-Start.sh is working.
My problem, with my python application, I have to run RoboDK. programmatically (I use RoboLink.py with the "Connect" function). With Windows OK, Linux not OK
Do you have solution please?
Posts: 2
Threads: 1
Joined: Jan 2019
Reputation:
2
I propose a modification in the code. This allows you to use RoboDK-Start.sh
def start_robodk(command):
print('Starting %s\n' % self.APPLICATION_DIR)
import subprocess
#导入时间
#tstart = time.time()
from sys import platform as _platform
if (_platform == "linux" or _platform == "linux2") and os.path.splitext(command[0])[1] == ".sh":
p = subprocess.Popen(command, shell=True, executable='/bin/bash', stdout=subprocess.PIPE)
else:
p = subprocess.Popen(command, stdout=subprocess.PIPE)
while True:
line = str(p.stdout.readline().decode("utf-8")).strip()
print(line)
if 'running' in line.lower():
#telapsed = time.time() - tstart
#print("RoboDK startup time: %.3f" % telapsed)
break
#with subprocess.Popen(command, stdout=subprocess.PIPE, bufsize=1, universal_newlines=True) as p:
# self._ProcessID = p.pid
# for line in p.stdout:
# line_ok = line.strip()
#打印(line_ok)
# if 'running' in line_ok.lower():
# print("RoboDK is running")
# return #does not return!!
import socket
connected = 0
for i in range(2):
for port in range(self.PORT_START,self.PORT_END+1):
self.COM = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.COM.settimeout(1)
try:
self.COM.connect((self.IP, port))
connected = self._is_connected()
if connected > 0:
self.COM.settimeout(self.TIMEOUT)
break
except:
connected = connected
if connected > 0:# if status is closed, try to open application
self.PORT = port
break;
elif i == 0:
if self.IP != 'localhost':
break;
try:
command = [self.APPLICATION_DIR] + self.ARGUMENTS
start_robodk(command)
#导入时间
#time.sleep(5) # wait for RoboDK to start and check network license.
except:
raise Exception('Application path is not correct or could not start: ' + self.APPLICATION_DIR)
if connected > 0 and not self._verify_connection():
connected = 0
return connected
Posts: 1,808
Threads: 2
Joined: Oct 2018
Reputation:
69
Hi Tonio163,
Thanks for your feed back, we really appreciate it.
Happy to see that you manage to fix the problem yourself.
Note that we will release a new version for Ubuntu next week with this among other corrections.
Jeremy