mirror of
https://github.com/ilri/csv-metadata-quality-web.git
synced 2024-11-30 02:18:20 +01:00
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.
This commit is contained in:
parent
0471820f3a
commit
8603ec4bca
5
main.py
5
main.py
@ -1,6 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
|
||||||
from base64 import b64decode, b64encode
|
from base64 import b64decode, b64encode
|
||||||
|
|
||||||
from ansi2html import Ansi2HTMLConverter
|
from ansi2html import Ansi2HTMLConverter
|
||||||
@ -59,12 +58,12 @@ def process_file(base64slug):
|
|||||||
app.config["UPLOAD_PATH"], os.path.splitext(filename)[0] + "-cleaned.csv"
|
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
|
# run subprocess and capture output as UTF-8 so we get a string instead of
|
||||||
# bytes for ansi2html
|
# bytes for ansi2html
|
||||||
results = subprocess.run(
|
results = subprocess.run(
|
||||||
["csv-metadata-quality"] + sys.argv[1:],
|
["csv-metadata-quality"] + args,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
encoding="UTF-8",
|
encoding="UTF-8",
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user