X-Git-Url: http://www.iramuteq.org/git?a=blobdiff_plain;f=tabchi2.py;h=aa5ea7c34edf09995da0676214c9042ac7a33722;hb=refs%2Fheads%2F3.0;hp=11922b3ffa37bb78f7a1589b1a886509147a7a39;hpb=eaa044d1147e26b82942ce56d5965c83fdddf069;p=iramuteq diff --git a/tabchi2.py b/tabchi2.py index 11922b3..aa5ea7c 100755 --- a/tabchi2.py +++ b/tabchi2.py @@ -143,13 +143,13 @@ class ChiSquare(AnalyseMatrix): cont<-1 """%(ffr(self.tableau.parametres['csvfile']), self.tableau.parametres['syscoding']) if len(self.colsel1)==1: - strsel1=str(self.colsel1).replace(',','') + strsel1=str(tuple(self.colsel1)).replace(',','') else: - strsel1=str(self.colsel1) + strsel1=str(tuple(self.colsel1)) if len(self.colsel2)==1: - strsel2=str(self.colsel2).replace(',','') + strsel2=str(tuple(self.colsel2)).replace(',','') else: - strsel2=str(self.colsel2) + strsel2=str(tuple(self.colsel2)) txt+=""" for (i in c%s) {""" % strsel1 txt+=""" @@ -308,7 +308,7 @@ class ChiSquare(AnalyseMatrix): """ % (ffr(self.parametres['pathout']),ffr(self.OutFrame)) tmpfile=tempfile.mktemp(dir=self.TEMPDIR) print(tmpfile) - tmpscript=open(tmpfile,'w') + tmpscript=open(tmpfile,'w', encoding='utf8') tmpscript.write(txt) tmpscript.close() pid = exec_rcode(self.RPath, tmpfile, wait = False) @@ -334,7 +334,7 @@ class ChiSquare(AnalyseMatrix): def dolayout(self, option): ListFile=[False] - file=open(self.OutFrame,'r') + file=open(self.OutFrame,'r', encoding='utf8') content=file.readlines() file.close() lcont = [line.replace('"','').replace('\n','').split(';') for line in content] @@ -381,7 +381,7 @@ class ChiSquare(AnalyseMatrix): allhtml.append(html_graphs) header=""" \n - \n + \n \n

Test du Chi2

\n
@@ -391,12 +391,12 @@ class ChiSquare(AnalyseMatrix): p <= 0.05 mais il y a des valeurs théoriques < 5
p > 0.05

- """%self.parent.SysEncoding + """ pretxt = '
\n'.join(links)+'


\n' txt = '


\n'.join(['

'.join([tab[i] for tab in allhtml]) for i,val in enumerate(res)]) txt = header + pretxt + txt + '\n' fileout=os.path.join(self.parametres['pathout'],'resultats-chi2.html') - with open(fileout, 'w') as f : + with open(fileout, 'w',encoding='utf8') as f : f.write(txt) ListFile.append(fileout) return ListFile