short_args, extra_args = getShortAndExtraArgs(args)
try:
(options, args) = parser.parse_args(short_args)
- except Exception, e:
- print e
+ except Exception as e:
+ print(e)
return
port = options.port
# copy the infile to the remote server
cmd = "scp %s %s@%s:%s" % (infile, user, machine, tmp_file)
- print "[ SCP ]", cmd
+ print("[ SCP ]", cmd)
os.system(cmd)
list_infiles.append(tmp_file)
# copy the salome script on the remote server
cmd = "scp %s %s@%s:%s" % (tmp_script, user, machine, tmp_script)
- print "[ SCP ]", cmd
+ print("[ SCP ]", cmd)
os.system(cmd)
return list_infiles, list_outfiles, tmp_script
# sa_obj is a ScriptAndArgs object (from salomeContextUtils)
def __runRemoteSession(sa_obj, params):
if not params.user:
- print "ERROR: The user login on remote machine MUST be given."
+ print("ERROR: The user login on remote machine MUST be given.")
return
if not params.directory:
- print "ERROR: The remote directory MUST be given."
+ print("ERROR: The remote directory MUST be given.")
return
# sa_obj.script may be 'python script.py' --> only process .py file
if params.port:
command = command + "-p %s "%params.port
command = command + " %s %s args:%s"%(header, tmp_script, ",".join(tmp_in))
- print '[ SSH ] ' + command
+ print('[ SSH ] ' + command)
os.system(command)
# Get remote files and clean
for outfile in (sa_obj.out or []):
remote_outfile = tmp_out.pop(0)
command = "scp %s@%s:%s %s" %(params.user, params.machine, remote_outfile, outfile)
- print "[ SCP ] " + command
+ print("[ SCP ] " + command)
os.system(command)
# clean temporary files
command = "ssh %s@%s \\rm -f %s" % (params.user, params.machine, " ".join(temp_files))
- print '[ SSH ] ' + command
+ print('[ SSH ] ' + command)
os.system(command)
os.remove(tmp_script)