Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Problem run RoboDK ubuntu

#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


Messages In This Thread
Problem run RoboDK ubuntu - byTonio163- 01-25-2019, 09:38 PM
RE: Problem run RoboDK ubuntu - byTonio163- 01-31-2019, 09:43 AM
RE: Problem run RoboDK ubuntu - byJeremy- 02-08-2019, 07:55 PM



Users browsing this thread:
1 Guest(s)