From 8603ec4bcae725334a76c9c5d6f30bce79799ae3 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Sat, 13 Mar 2021 12:52:22 +0200 Subject: [PATCH] main.py: Rework command line args Turns out we only need to use sys.argv when we were trying to run the csv-metadata-quality module directly in Python by importing it. --- main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index ab03f80..4301109 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,5 @@ import os import subprocess -import sys from base64 import b64decode, b64encode from ansi2html import Ansi2HTMLConverter @@ -59,12 +58,12 @@ def process_file(base64slug): app.config["UPLOAD_PATH"], os.path.splitext(filename)[0] + "-cleaned.csv" ) - sys.argv = ["", "-i", input_file, "-o", output_file] + args = ["-i", input_file, "-o", output_file] # run subprocess and capture output as UTF-8 so we get a string instead of # bytes for ansi2html results = subprocess.run( - ["csv-metadata-quality"] + sys.argv[1:], + ["csv-metadata-quality"] + args, capture_output=True, encoding="UTF-8", )