From 7de7bb514d3bff82cf907cbf66dda17ab14d165d Mon Sep 17 00:00:00 2001 From: Chuck McCallum Date: Tue, 19 Nov 2024 17:17:02 -0500 Subject: [PATCH] Write to a relative temp dir (#167) --- dp_wizard/tmp/.gitignore | 1 + dp_wizard/utils/argparse_helpers.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 dp_wizard/tmp/.gitignore diff --git a/dp_wizard/tmp/.gitignore b/dp_wizard/tmp/.gitignore new file mode 100644 index 0000000..88c42d9 --- /dev/null +++ b/dp_wizard/tmp/.gitignore @@ -0,0 +1 @@ +demo.csv diff --git a/dp_wizard/utils/argparse_helpers.py b/dp_wizard/utils/argparse_helpers.py index 4b6dd9d..36bf603 100644 --- a/dp_wizard/utils/argparse_helpers.py +++ b/dp_wizard/utils/argparse_helpers.py @@ -81,10 +81,10 @@ def _get_demo_csv_contrib(): """ random.seed(0) # So the mock data will be stable across runs. - csv_path = "/tmp/demo.csv" + csv_path = Path(__file__).parent.parent / "tmp" / "demo.csv" contributions = 10 - with open(csv_path, "w", newline="") as demo_handle: + with csv_path.open("w", newline="") as demo_handle: fields = ["student_id", "class_year", "hw_number", "grade"] writer = csv.DictWriter(demo_handle, fieldnames=fields) writer.writeheader()