Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4284

Troubleshooting • saves .xlsx file as pi but .csv file as root

$
0
0
I have code that saves the temperature from a ds18b20 temperature probe and it saves the result to a xlsx file and a csv file because I am learning how to save data.

I have noticed that when it saves the files it saves the xlsx file as pi but the csv file as root.
Why would the raspberry pi do that?

The code is run as python w1probes.py

Code:

[-rw-r--r-- 1 root root    125 Mar 23 15:23 w1probes.csv-rw-r--r-- 1 pi   pi     8958 Mar 23 15:23 w1probes.xlsx-rwxr-xr-x 1 pi   pi     2544 Mar 23 15:23 w1probes.py/code][code]    wb = load_workbook('/home/pi/w1/w1probes.xlsx')    sheet = wb['Sheet1']    row = (today, now,  "Probe 1" ,temperature_results[0])     sheet.append(row)    #Save the workbook    wb.save('/home/pi/w1/w1probes.xlsx')        with open('/home/pi/w1/w1probes.csv' , "a") as f:        f.write(currenttimesecs.strftime('%d-%m-%Y , %H:%M:%S' + " , "))        f.write("Probe 1:, ")        f.write(temperature_results[0] + ", ")        f.write("\n")

Statistics: Posted by sandy70 — Sun Mar 23, 2025 3:36 pm



Viewing all articles
Browse latest Browse all 4284

Trending Articles