From 7eb52f8f1c6e3af60b220e87ff36fd5220183994 Mon Sep 17 00:00:00 2001 From: Ieva C Date: Mon, 11 May 2020 11:56:59 +0100 Subject: [PATCH 1/3] Remove NameError from tutor.py --- examples/tutorials/tutor.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/examples/tutorials/tutor.py b/examples/tutorials/tutor.py index ecfc37ad4..ff25e8e81 100644 --- a/examples/tutorials/tutor.py +++ b/examples/tutorials/tutor.py @@ -44,8 +44,4 @@ def main(root_dir): sys.exit(1) root_dir = sys.argv[1] - try: - main(root_dir) - except NameError as e: - print(e) - print(usage) + main(root_dir) From a846fde6e7ee5466d3f7163b61d4a32f8c1f5c76 Mon Sep 17 00:00:00 2001 From: Ieva C Date: Mon, 11 May 2020 12:23:23 +0100 Subject: [PATCH 2/3] Take current directory as default --- examples/tutorials/tutor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/tutorials/tutor.py b/examples/tutorials/tutor.py index ff25e8e81..00ddf97c1 100644 --- a/examples/tutorials/tutor.py +++ b/examples/tutorials/tutor.py @@ -43,5 +43,10 @@ def main(root_dir): print(usage) sys.exit(1) - root_dir = sys.argv[1] + # Determine the root path to use for the tutorial files: + if len(sys.argv) == 2: + root_dir = sys.argv[1] + else: + root_dir = os.getcwd() + main(root_dir) From 3174f9bd343fd4102f12c8f19a2d2e631b07942a Mon Sep 17 00:00:00 2001 From: Ieva C Date: Mon, 11 May 2020 16:00:17 +0100 Subject: [PATCH 3/3] Relax argument number constraint --- examples/tutorials/tutor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/tutor.py b/examples/tutorials/tutor.py index 00ddf97c1..56063985e 100644 --- a/examples/tutorials/tutor.py +++ b/examples/tutorials/tutor.py @@ -39,7 +39,7 @@ def main(root_dir): if __name__ == '__main__': # Validate the command line arguments: - if len(sys.argv) != 2: + if len(sys.argv) > 2: print(usage) sys.exit(1)