Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -44,6 +44,14 @@ def store_message(name: str, message: str, outputfileName: str):
|
|
44 |
if (file_exists==False):
|
45 |
with open(savePath, "w") as f: #write
|
46 |
f.write(str("time, message, text\n")) # one time only to get column headers for CSV file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
else:
|
48 |
if name and message:
|
49 |
with open(savePath, "a") as csvfile:
|
|
|
44 |
if (file_exists==False):
|
45 |
with open(savePath, "w") as f: #write
|
46 |
f.write(str("time, message, text\n")) # one time only to get column headers for CSV file
|
47 |
+
if name and message:
|
48 |
+
with open(savePath, "a") as csvfile:
|
49 |
+
writer = csv.DictWriter(csvfile, fieldnames=[ "time", "message", "name", ])
|
50 |
+
writer.writerow(
|
51 |
+
{"time": str(datetime.now()), "message": message.strip(), "name": name.strip() }
|
52 |
+
)
|
53 |
+
df = pd.read_csv(savePath)
|
54 |
+
df = df.sort_values(df.columns[0],ascending=False)
|
55 |
else:
|
56 |
if name and message:
|
57 |
with open(savePath, "a") as csvfile:
|