aboutsummaryrefslogtreecommitdiff
path: root/backend/tolData/reviewImgsToGen.py
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2022-08-20 13:16:21 +1000
committerTerry Truong <terry06890@gmail.com>2022-08-20 13:16:21 +1000
commit930c12d33e1093f874a4beb4d6376621e464e8c0 (patch)
tree381722fc3ab9ebda482cb18d29e1091458aa93da /backend/tolData/reviewImgsToGen.py
parent8144003565797f0d18645a416b95d4365bba5fdd (diff)
Use argparse in python scripts
Diffstat (limited to 'backend/tolData/reviewImgsToGen.py')
-rwxr-xr-xbackend/tolData/reviewImgsToGen.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/backend/tolData/reviewImgsToGen.py b/backend/tolData/reviewImgsToGen.py
index de592f5..88822c5 100755
--- a/backend/tolData/reviewImgsToGen.py
+++ b/backend/tolData/reviewImgsToGen.py
@@ -7,9 +7,8 @@ from tkinter import ttk
import PIL
from PIL import ImageTk, Image, ImageOps
-usageInfo = f"""
-Usage: {sys.argv[0]}
-
+import argparse
+parser = argparse.ArgumentParser(description="""
Provides a GUI that displays, for each node in the database, associated
images from EOL and Wikipedia, and allows choosing which to use. Writes
choice data to a text file with lines of the form 'otolId1 imgPath1', or
@@ -18,10 +17,8 @@ choice data to a text file with lines of the form 'otolId1 imgPath1', or
The program can be closed, and run again to continue from the last choice.
The program looks for an existing output file to determine what choices
have already been made.
-"""
-if len(sys.argv) > 1:
- print(usageInfo, file=sys.stderr)
- sys.exit(1)
+""", formatter_class=argparse.RawDescriptionHelpFormatter)
+parser.parse_args()
eolImgDir = "eol/imgs/"
enwikiImgDir = "enwiki/imgs/"