My stylesheet is empty when requesting it

Question: So my repl has a custom module for reading a new file type, and the non-parsed file basically looks something like this:

[This is a comment! Well, not really...]
key{val} [Basic stuff, right?]

It can parse that file into a dict like {"key": "val"}, but the thing is not the module, it works fine, however, the stylesheet is gone because I want to set a custom font family into an user’s file named prefs.wsy, something like:

font{sans-serif} [Don't forget the old web-fonts!]

It parses to a dict thanks to the module, but then the weird part: there’s a tempStyle.css stylesheet that contains text, but there are some little parts like %f% I use to replace them to the decided font, it works! But when it returns send_file("style.css"), it shows the file is empty, but in the directories the file is not empty, so, what is happening, and is it me dreaming about the thing that the code is working?

Repl link: wafflesys - Python Repl - Replit

from flask import *
import os
from glob import glob
import time
import readwsy

app = Flask("app")

def doNothing():
	return None

@app.route("/style.css")
def style():
	originalStyle = open("tempStyle.css").read()
	stylesheet = open("style.css", "w")
	try:
		if "prefs.wsy" in glob("users/" + request.headers["X-Replit-User-Name"]):
			wsyDict = readwsy.open("users/" + request.headers["X-Replit-User-Name"] + "/prefs.wsy")
		else:
			wsyDict = {"font": "monospace"}
	except:
		wsyDict = {"font": "monospace"} # Not logged in? Make the style default {:'D
	originalStyle = originalStyle.replace("%f%", wsyDict["font"])
	stylesheet.write(originalStyle)
	return send_file("style.css")

@app.route("/")
def loginRedirect():
	if "X-Replit-User-Name" in request.headers:
		if not os.path.exists(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"]):
			os.makedirs(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"])
			os.chdir(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"])
			open(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"] + "/" + "untitled.txt", "w+").write("Welcome to the Wafflesys editor!\nDue to Wafflesys being in beta, this is currently a textarea\nWhat to do? Press the [CTRL] and [A] keys and then the [⟵] (backspace) key to erase everything in this textarea")
	return redirect("/storage/")

@app.route("/users/")
def userList():
	userTemp = "<li>%u%</li>"
	userHTML = "\t\t<ul>\n\t\t\t<li><strong>" + request.headers["X-Replit-User-Name"] + "</strong></li>\n"
	noUserHTML = "\t\t<div id=\"errorMsg\">No users found</div>"
	os.chdir("users")
	users = glob("*")
	os.chdir("..")
	try:
		users.remove(request.headers["X-Replit-User-Name"])
	except ValueError: # User is logged in but not in the user list
		doNothing()
	for user in users:
		if user[:-1] != "/":
			users.remove(user)
			continue
		user = user[:-1] # Remove the forward slash at the end
		userHTML += "\t\t\t" + userTemp.replace("%u%", user) + "</li>\n"
	userHTML = userHTML + "\t\t</ul>"
	return open("userList.html").read().replace("%u%", userHTML)

@app.route("/storage/")
def storage():
	if not os.path.exists(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"]):
		os.makedirs(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"])
		os.chdir(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"])
		open(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"] + "/" + "untitled.txt", "w+").write("Welcome to the Wafflesys editor!\nDue to Wafflesys being in beta, this is currently a textarea\nWhat to do? Press the [CTRL] and [A] keys and then the [⟵] (backspace) key to erase everything in this textarea")
	fileTemp = '<li><a href="/storage/edit/%f%">%f%</a></li>'
	fileHTML = ""
	time.sleep(0.1)
	os.chdir(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"])
	files = glob("*")
	os.chdir("../..")
	for item in files:
		fileHTML += "\t\t\t" + fileTemp.replace("%f%", str(item)) + "\n"
	fileHTML = fileHTML[:-1]
	if "error" in request.args:
		return open("errorStorage.html").read().replace("%f%", fileHTML)
	return open("storage.html").read().replace("%f%", fileHTML)

@app.route("/storage/new/", methods=["POST"])
def newFile():
	if os.path.exists(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"]):
		os.chdir(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"])
		if len(glob("*")) >= 100:
			for file in glob("*"):
				os.remove(file)
		os.chdir("../..")
		count = ""
		if os.path.exists(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"] + "/untitled.txt"):
			count = 1
			while os.path.exists(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"] + "/untitled" + str(count) + ".txt"):
				count += 1
		open(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"] + "/" + "untitled" + str(count) + ".txt", "w").write("Welcome to the Wafflesys editor!\nDue to Wafflesys being in beta, this is currently a textarea\nWhat to do? Press the [CTRL] and [A] keys and then the [⟵] (backspace) key to erase everything in this textarea")
		return redirect("/storage/edit/untitled" + str(count) + ".txt")
	else:
		return redirect("/storage/")

@app.route("/storage/save/", methods=["POST"])
def saveFile():
	if os.path.exists(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"]):
		if "file" not in request.form or "content" not in request.form:
			return redirect("/storage/?error")
		try:
			open(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"] + "/" + request.form["file"], "w").write(request.form["content"])
		except FileNotFoundError:
			return redirect("/storage/?error")
		return redirect("/storage/edit/" + request.form["file"])
	else:
		return redirect("/storage/")

@app.route("/storage/rename/", methods=["POST"])
def renameFile():
	if os.path.exists(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"]):
		if "original" not in request.form or "new" not in request.form:
			return redirect("/storage/?error")
		try:
			original = open(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"] + "/" + request.form["original"]).read()
		except FileNotFoundError:
			return redirect("/storage/?error")
		os.remove(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"] + "/" + request.form["original"])
		try:
			open(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"] + "/" + request.form["new"], "w").write(original)
		except IsADirectoryError:
			open(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"] + "/" + request.form["original"], "w").write(original)
			return redirect("/storage/?error")
		except FileNotFoundError:
			return redirect("/storage/?error")
		return redirect("/storage/edit/" + request.form["new"])
	else:
		return redirect("/storage/")

@app.route("/storage/edit/<path:path>")
def storagePath(path):
	if os.path.exists(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"] + "/" + path):
		if "raw" in request.form:
			return send_from_directory((os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"]), path)
		else:
			return open("read.html").read().replace("%n%", path).replace("%c%", open(os.environ["PWD"] + "/users/" + request.headers["X-Replit-User-Name"] + "/" + path).read())
	return redirect("/storage/?error")

app.run(host="0.0.0.0", port=8080)

readwsy module:

import re as regex

def open(file):
	file = regex.sub(r"\[.*\]", "", open(file), 0, regex.MULTILINE)
	keys = regex.findall(r".+(?={)", file, regex.MULTILINE)
	values = regex.findall(r"", file, re.MULTILINE)
	count = 0
	for val in values.copy():
		values[count] = val[:-1]
	out = {}
	for (key, val) in (keys, values):
		out[key] = val
	return out