Skip to content

Commit

Permalink
Use filemode 666 instead of 777 for output files in python scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
chr4 committed Feb 15, 2022
1 parent aa21830 commit 8a4d5fb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions runs/csvcalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def fillcount(row, datestring, file_stringo, firstfile):
f1 = open(file_stringo, 'w')
f1.write(str(headerst))
f1.close()
os.chmod(file_stringo, 0o777)
os.chmod(file_stringo, 0o666)
else:
f1 = open(file_stringo, 'a')
excelstring = exceldate(countercsv[0])
Expand Down Expand Up @@ -329,7 +329,7 @@ def fillcounts(monhtrow, file_stringos, lastdate, lastzeit):
line = line + str(0) + '\n'
f1.write(str(line))
f1.close()
os.chmod(file_stringos, 0o777)
os.chmod(file_stringos, 0o666)
print('%s %s written' % (getTime(), file_stringos))
for i in range(1, SUMCOLUMNSTART):
if (i < len(monhtrow)):
Expand Down Expand Up @@ -396,13 +396,13 @@ def reyeardet(calcyear):
print('%s Yearerror %s inhalt %s' % (getTime(), file_stringis, str(e)))
if (validdata == 1):
f1.close()
os.chmod(file_stringo, 0o777)
os.chmod(file_stringo, 0o666)
f1 = open(file_stringos, 'w')
line = 'Anzahl Spalten,' + str(startspalten) + ',Letzes Datum,' + complastdate + ',Letzte Zeit,' + complastzeit + ', \n'
f1.write(str(line))
f1.write(str(headerline))
f1.close()
os.chmod(file_stringos, 0o777)
os.chmod(file_stringos, 0o666)
print('%s %s written' % (getTime(), file_stringos))
return

Expand Down
14 changes: 7 additions & 7 deletions runs/csvselmonth.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ def selmonth(jjjjmm):
f1 = open( outputfile + 'a_onl3', 'w')
f1.write(str(sumlineb))
f1.close()
os.chmod(outputfile + 'a_onl1', 0o777)
os.chmod(outputfile + 'a_onl2', 0o777)
os.chmod(outputfile + 'a_onl3', 0o777)
os.chmod(outputfile + 'a_onl1', 0o666)
os.chmod(outputfile + 'a_onl2', 0o666)
os.chmod(outputfile + 'a_onl3', 0o666)
#lesen gesamtes monatsfile
ifile=0
try:
Expand Down Expand Up @@ -141,10 +141,10 @@ def selmonth(jjjjmm):
f2.close()
f3.close()
f4.close()
os.chmod(outputfile + 'a_onl4', 0o777)
os.chmod(outputfile + 'a_onl5', 0o777)
os.chmod(outputfile + 'a_onl6', 0o777)
os.chmod(outputfile + 'a_onl7', 0o777)
os.chmod(outputfile + 'a_onl4', 0o666)
os.chmod(outputfile + 'a_onl5', 0o666)
os.chmod(outputfile + 'a_onl6', 0o666)
os.chmod(outputfile + 'a_onl7', 0o666)
except Exception as e:
print ('%s error1 %s inhalt %s' % (getTime(),datestring, str(e) ))
if (ifile == 0):
Expand Down
6 changes: 3 additions & 3 deletions runs/csvselyear.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def selyear(jjjjmm):
f1 = open( outputfile + 'b_onl1', 'w')
f1.write(str(headerline))
f1.close()
os.chmod(outputfile + 'b_onl1', 0o777)
os.chmod(outputfile + 'b_onl1', 0o666)
#lesen gesamtes Jahresfile
ifile=0
try:
Expand Down Expand Up @@ -116,8 +116,8 @@ def selyear(jjjjmm):
f.close()
f1.close()
f2.close()
os.chmod(outputfile + 'b_onl4', 0o777)
os.chmod(outputfile + 'b_onl5', 0o777)
os.chmod(outputfile + 'b_onl4', 0o666)
os.chmod(outputfile + 'b_onl5', 0o666)
except Exception as e:
print ('%s error1 %s inhalt %s' % (getTime(),file_cvsfinp, str(e) ))
if (ifile == 0):
Expand Down
2 changes: 1 addition & 1 deletion runs/smarthomehandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
f = open(filename, 'w')
f.write(str("0"))
f.close()
os.chmod(filename, 0o777)
os.chmod(filename, 0o666)
global numberOfDevices

def cleardef(nummer):
Expand Down

0 comments on commit 8a4d5fb

Please sign in to comment.