My apologies, here are some more details.
This is the script I'm running:
from sense_hat import SenseHat
import time
import datetime
# Import smtplib for the actual sending function
import smtplib, ssl
#Get the temperature data and write it to the file
def temp_data(sense, wfile):
temp =...