Commit 5e27f790 authored by Elijah Andrews's avatar Elijah Andrews

Improved robustness of csv writing function.

parent 8b9236da
......@@ -6,7 +6,8 @@ from PyQt5.QtWidgets import QFileDialog, QApplication
def lists_to_csv(file_dir, filename, lists, headers=None, overwrite=False):
if os.path.exists(file_dir + filename) and not overwrite:
print(f"Warning: file already exists. {file_dir + filename}")
os.makedirs(file_dir, exist_ok=True)
if file_dir != "":
os.makedirs(file_dir, exist_ok=True)
file = open(file_dir + filename, "w")
if headers:
line = ""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment