aboutsummaryrefslogtreecommitdiff
path: root/backend/tolData/genEnwikiDescData.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/genEnwikiDescData.py
parent8144003565797f0d18645a416b95d4365bba5fdd (diff)
Use argparse in python scripts
Diffstat (limited to 'backend/tolData/genEnwikiDescData.py')
-rwxr-xr-xbackend/tolData/genEnwikiDescData.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/backend/tolData/genEnwikiDescData.py b/backend/tolData/genEnwikiDescData.py
index 0e86fd5..e8a69ba 100755
--- a/backend/tolData/genEnwikiDescData.py
+++ b/backend/tolData/genEnwikiDescData.py
@@ -3,16 +3,13 @@
import sys, re, os
import sqlite3
-usageInfo = f"""
-Usage: {sys.argv[0]}
-
+import argparse
+parser = argparse.ArgumentParser(description="""
Reads a database containing data from Wikipedia, and tries to associate
wiki pages with nodes in the tree-of-life database, and add descriptions for
nodes that don't have them.
-"""
-if len(sys.argv) > 1:
- print(usageInfo, file=sys.stderr)
- sys.exit(1)
+""", formatter_class=argparse.RawDescriptionHelpFormatter)
+parser.parse_args()
enwikiDb = "enwiki/descData.db"
dbFile = "data.db"