def start_processing(self): logging.debug("ready to open progress") self.wizard.next(Progress, message = 'Processing.....') os.chdir(self.wizard.cwd) fh, xl_name = tempfile.mkstemp(suffix=".xls", prefix='project_'+datetime.datetime.today().strftime("%Y%m%d_%H%M%S")+"_", dir=os.path.dirname(self.customer_file)) os.close(fh) os.unlink(xl_name) logging.debug("XL: "+xl_name) copy_customers_dbf = os.path.splitext(os.path.basename(self.customer_file))[0]+"_results_"+datetime.datetime.today().strftime("%Y%m%d_%H%M%S")+".shp" maxruntime = self.maxruntime.GetValue() if maxruntime == '' : maxruntime = None else: h,m,s = maxruntime.split(":") maxruntime = ((int(h) * 60) + int(m) * 60) + int(s) project_id, errors = dbf_to_xl.process( customer_file = self.customer_file, facility_file = self.facility_file, vehicle_file = self.vehicle_file, copy_customers_dbf = copy_customers_dbf, save_file = xl_name, resequence = self.optimization_type.GetSelection() == self.Sequence_Routes, params = { 'parameter_loading_duration_per_unit' : 0, 'parameter_notification_email' : self.email.GetValue(), 'parameter_user_data1' : json.dumps({ 'dir': os.path.dirname(os.path.abspath(self.customer_file)), 'user' : os.environ.get( "USERNAME" ), 'copy_customers_dbf' : copy_customers_dbf }) } ) if project_id: self.wizard.next(Progress, message = "Initializing....") monitor = Route(project_id) args = {} stop_condition = self.stop_condition.GetSelection() if stop_condition == self.Till_Time : args['timed'] = maxruntime elif stop_condition == self.Till_Nearly_Done : args['stop_when_nearly_done'] = True rez = monitor.start(**args) if 'start' not in rez: wx.MessageBox("There has been an error in routing: "+inspect(rez)) exit(1) logging.debug("ready to open monitor optimization page") self.wizard.next(Monitor_Optimization_Page, project_id = project_id) else: self.wizard.next(Progress, message = "Failed to send to RouteApp:\n%s" % ",".join(errors))