Skip to content

Bug in using argparse and multiple repetition of default values #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions yt_crawl.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def parseAcademy():
output.append(entry)
return output

def run(api_key, gitCommit, datasetOutputLocation="dataset.json"):
def run(api_key, gitCommit, datasetOutputLocation):
videos = []
print("Parsing Academy Courses")
output = parseAcademy()
Expand Down Expand Up @@ -229,7 +229,7 @@ def run(api_key, gitCommit, datasetOutputLocation="dataset.json"):
gitDescription = "Updated dataset"
print(f"Commiting to git, with commit description {gitDescription}")
from subprocess import call
# call(["git", "commit", "-m", gitDescription, datasetOutputLocation])
call(["git", "commit", "-m", gitDescription, datasetOutputLocation])
else:
print("Done! Now commit to git")

Expand All @@ -246,16 +246,15 @@ def parser():
help="The output path",
default="dataset.json")
parser.add_argument(
'-g', '--git-commit',
help="Automatically commit the dataset file to git (uses git cli)",
default=False,
type=bool)
'-g', '--git_commit',
help="Automatically commit the dataset file to git (uses git cli)",
action='store_true')
args = parser.parse_args()
if not args.api_key:
args.api_key = open('yt.secret').read()

run(args.api_key, args.output_file)
run(args.api_key, args.git_commit, args.output_file)


if __name__ == "__main__":
if(__name__ == "__main__"):
parser()