X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=functions.py;h=730d1355d16350f29f96a1c804cd8e58dddfaffb;hp=aee5d9bc77971fc856550e53ea54352f31589045;hb=7f5e0ba6ece181a04d872a7b6eeb2f13b33aa455;hpb=5d8a0a0e99d9075adc28f2525fe0aba8e14c2b0a diff --git a/functions.py b/functions.py index aee5d9b..730d135 100644 --- a/functions.py +++ b/functions.py @@ -64,7 +64,7 @@ class History : tosave['corpus'] = analyse['corpus'] tosave['name'] = analyse['name'] acorpus_uuid = analyse['corpus'] - if acorpus_uuid in self.ordercorpus : + if acorpus_uuid in self.corpus : if 'analyses' in self.history[self.ordercorpus[acorpus_uuid]] : self.history[self.ordercorpus[acorpus_uuid]]['analyses'].append(tosave) else : @@ -388,23 +388,14 @@ def BugReport(parent, error = None): txt += exc dial = BugDialog(parent) - #for line in formatExceptionInfo(): - # if type(line) == type([]): - # for don in line: - # txt += don.replace(' ', ' ') - # else: - # txt += line + '\n' if 'Rerror' in dir(parent) : txt += parent.Rerror parent.Rerror = '' - #if error is not None : - # txt += '\n%s\n' %error - print formatExceptionInfo() - log.error(txt) + log.info(txt) dial.text_ctrl_1.write(txt) dial.CenterOnParent() dial.ShowModal() - #raise Exception('Bug') + dial.Destroy() def PlaySound(parent): if parent.pref.getboolean('iramuteq', 'sound') : @@ -462,6 +453,12 @@ def ReadList(filein, encoding = sys.getdefaultencoding()): i += 1 return dict, first +def exec_RCMD(rpath, command) : + log.info('R CMD INSTALL %s' % command) + rpath = rpath.replace('\\','\\\\') + error = call(["%s" % rpath, 'CMD', 'INSTALL', "%s" % command]) + return error + def exec_rcode(rpath, rcode, wait = True, graph = False): log.info("R Script : %s" % rcode) needX11 = False @@ -514,20 +511,27 @@ def check_Rresult(parent, pid) : if isinstance(pid, Popen) : if pid.returncode != 0 : error = pid.communicate() + print error error = [str(error[0]), error[1]] if error[1] is None : error[1] = 'None' parent.Rerror = '\n'.join([str(pid.returncode), '\n'.join(error)]) - try : - raise Exception('\n'.join(u'Erreur R', '\n'.join(error[1:]))) - except : - BugReport(parent) + #try : + raise Exception('\n'.join([u'Erreur R', '\n'.join(error[1:])])) + return False + #except : + # BugReport(parent) + else : + return True else : if pid != 0 : - try : - raise Exception(u'Erreur R') - except : - BugReport(parent) + #try : + raise Exception(u'Erreur R') + return False + #except : + # BugReport(parent) + else : + return True def print_liste(filename,liste): with open(filename,'w') as f :