We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Elasticdl client crashes with invalid args
```
$ elasticdl -v
Traceback (most recent call last):
  File "/usr/local/bin/elasticdl", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/elasticdl_client/main.py", line 97, in main
    args, _ = parser.parse_known_args()
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py", line 1787, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py", line 2022, in _parse_known_args
    ', '.join(required_actions))
TypeError: sequence item 0: expected str instance, NoneType found
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `elasticdl_client/main.py`
Content:
```
1 # Copyright 2020 The ElasticDL Authors. All rights reserved.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
5 #
6 # http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13 
14 import argparse
15 import sys
16 
17 from elasticdl_client.api import (
18     build_zoo,
19     evaluate,
20     init_zoo,
21     predict,
22     push_zoo,
23     train,
24 )
25 from elasticdl_client.common import args
26 
27 
28 def build_argument_parser():
29     parser = argparse.ArgumentParser()
30     subparsers = parser.add_subparsers()
31     subparsers.required = True
32 
33     # Initialize the parser for the `elasticdl zoo` commands
34     zoo_parser = subparsers.add_parser(
35         "zoo",
36         help="Initialize | Build | Push a docker image for the model zoo.",
37     )
38     zoo_subparsers = zoo_parser.add_subparsers()
39     zoo_subparsers.required = True
40 
41     # elasticdl zoo init
42     zoo_init_parser = zoo_subparsers.add_parser(
43         "init", help="Initialize the model zoo."
44     )
45     zoo_init_parser.set_defaults(func=init_zoo)
46     args.add_zoo_init_params(zoo_init_parser)
47 
48     # elasticdl zoo build
49     zoo_build_parser = zoo_subparsers.add_parser(
50         "build", help="Build a docker image for the model zoo."
51     )
52     zoo_build_parser.set_defaults(func=build_zoo)
53     args.add_zoo_build_params(zoo_build_parser)
54 
55     # elasticdl zoo push
56     zoo_push_parser = zoo_subparsers.add_parser(
57         "push",
58         help="Push the docker image to a remote registry for the distributed"
59         "ElasticDL job.",
60     )
61     zoo_push_parser.set_defaults(func=push_zoo)
62     args.add_zoo_push_params(zoo_push_parser)
63 
64     # elasticdl train
65     train_parser = subparsers.add_parser(
66         "train", help="Submit a ElasticDL distributed training job"
67     )
68     train_parser.set_defaults(func=train)
69     args.add_common_params(train_parser)
70     args.add_train_params(train_parser)
71 
72     # elasticdl evaluate
73     evaluate_parser = subparsers.add_parser(
74         "evaluate", help="Submit a ElasticDL distributed evaluation job"
75     )
76     evaluate_parser.set_defaults(func=evaluate)
77     args.add_common_params(evaluate_parser)
78     args.add_evaluate_params(evaluate_parser)
79 
80     # elasticdl predict
81     predict_parser = subparsers.add_parser(
82         "predict", help="Submit a ElasticDL distributed prediction job"
83     )
84     predict_parser.set_defaults(func=predict)
85     args.add_common_params(predict_parser)
86     args.add_predict_params(predict_parser)
87 
88     return parser
89 
90 
91 def main():
92     parser = build_argument_parser()
93     if len(sys.argv) == 1:
94         parser.print_help(sys.stderr)
95         sys.exit(1)
96 
97     args, _ = parser.parse_known_args()
98     args.func(args)
99 
100 
101 if __name__ == "__main__":
102     main()
103
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/elasticdl_client/main.py b/elasticdl_client/main.py
--- a/elasticdl_client/main.py
+++ b/elasticdl_client/main.py
@@ -94,7 +94,12 @@
         parser.print_help(sys.stderr)
         sys.exit(1)
 
-    args, _ = parser.parse_known_args()
+    try:
+        args, _ = parser.parse_known_args()
+    except TypeError:
+        parser.print_help(sys.stderr)
+        sys.exit(1)
+
     args.func(args)

{"golden_diff": "diff --git a/elasticdl_client/main.py b/elasticdl_client/main.py\n--- a/elasticdl_client/main.py\n+++ b/elasticdl_client/main.py\n@@ -94,7 +94,12 @@\n         parser.print_help(sys.stderr)\n         sys.exit(1)\n \n-    args, _ = parser.parse_known_args()\n+    try:\n+        args, _ = parser.parse_known_args()\n+    except TypeError:\n+        parser.print_help(sys.stderr)\n+        sys.exit(1)\n+\n     args.func(args)\n", "issue": "Elasticdl client crashes with invalid args\n```\r\n$ elasticdl -v\r\nTraceback (most recent call last):\r\n  File \"/usr/local/bin/elasticdl\", line 8, in <module>\r\n    sys.exit(main())\r\n  File \"/usr/local/lib/python3.7/site-packages/elasticdl_client/main.py\", line 97, in main\r\n    args, _ = parser.parse_known_args()\r\n  File \"/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py\", line 1787, in parse_known_args\r\n    namespace, args = self._parse_known_args(args, namespace)\r\n  File \"/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py\", line 2022, in _parse_known_args\r\n    ', '.join(required_actions))\r\nTypeError: sequence item 0: expected str instance, NoneType found\r\n```\n", "before_files": [{"content": "# Copyright 2020 The ElasticDL Authors. All rights reserved.\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport sys\n\nfrom elasticdl_client.api import (\n    build_zoo,\n    evaluate,\n    init_zoo,\n    predict,\n    push_zoo,\n    train,\n)\nfrom elasticdl_client.common import args\n\n\ndef build_argument_parser():\n    parser = argparse.ArgumentParser()\n    subparsers = parser.add_subparsers()\n    subparsers.required = True\n\n    # Initialize the parser for the `elasticdl zoo` commands\n    zoo_parser = subparsers.add_parser(\n        \"zoo\",\n        help=\"Initialize | Build | Push a docker image for the model zoo.\",\n    )\n    zoo_subparsers = zoo_parser.add_subparsers()\n    zoo_subparsers.required = True\n\n    # elasticdl zoo init\n    zoo_init_parser = zoo_subparsers.add_parser(\n        \"init\", help=\"Initialize the model zoo.\"\n    )\n    zoo_init_parser.set_defaults(func=init_zoo)\n    args.add_zoo_init_params(zoo_init_parser)\n\n    # elasticdl zoo build\n    zoo_build_parser = zoo_subparsers.add_parser(\n        \"build\", help=\"Build a docker image for the model zoo.\"\n    )\n    zoo_build_parser.set_defaults(func=build_zoo)\n    args.add_zoo_build_params(zoo_build_parser)\n\n    # elasticdl zoo push\n    zoo_push_parser = zoo_subparsers.add_parser(\n        \"push\",\n        help=\"Push the docker image to a remote registry for the distributed\"\n        \"ElasticDL job.\",\n    )\n    zoo_push_parser.set_defaults(func=push_zoo)\n    args.add_zoo_push_params(zoo_push_parser)\n\n    # elasticdl train\n    train_parser = subparsers.add_parser(\n        \"train\", help=\"Submit a ElasticDL distributed training job\"\n    )\n    train_parser.set_defaults(func=train)\n    args.add_common_params(train_parser)\n    args.add_train_params(train_parser)\n\n    # elasticdl evaluate\n    evaluate_parser = subparsers.add_parser(\n        \"evaluate\", help=\"Submit a ElasticDL distributed evaluation job\"\n    )\n    evaluate_parser.set_defaults(func=evaluate)\n    args.add_common_params(evaluate_parser)\n    args.add_evaluate_params(evaluate_parser)\n\n    # elasticdl predict\n    predict_parser = subparsers.add_parser(\n        \"predict\", help=\"Submit a ElasticDL distributed prediction job\"\n    )\n    predict_parser.set_defaults(func=predict)\n    args.add_common_params(predict_parser)\n    args.add_predict_params(predict_parser)\n\n    return parser\n\n\ndef main():\n    parser = build_argument_parser()\n    if len(sys.argv) == 1:\n        parser.print_help(sys.stderr)\n        sys.exit(1)\n\n    args, _ = parser.parse_known_args()\n    args.func(args)\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "elasticdl_client/main.py"}], "after_files": [{"content": "# Copyright 2020 The ElasticDL Authors. All rights reserved.\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport sys\n\nfrom elasticdl_client.api import (\n    build_zoo,\n    evaluate,\n    init_zoo,\n    predict,\n    push_zoo,\n    train,\n)\nfrom elasticdl_client.common import args\n\n\ndef build_argument_parser():\n    parser = argparse.ArgumentParser()\n    subparsers = parser.add_subparsers()\n    subparsers.required = True\n\n    # Initialize the parser for the `elasticdl zoo` commands\n    zoo_parser = subparsers.add_parser(\n        \"zoo\",\n        help=\"Initialize | Build | Push a docker image for the model zoo.\",\n    )\n    zoo_subparsers = zoo_parser.add_subparsers()\n    zoo_subparsers.required = True\n\n    # elasticdl zoo init\n    zoo_init_parser = zoo_subparsers.add_parser(\n        \"init\", help=\"Initialize the model zoo.\"\n    )\n    zoo_init_parser.set_defaults(func=init_zoo)\n    args.add_zoo_init_params(zoo_init_parser)\n\n    # elasticdl zoo build\n    zoo_build_parser = zoo_subparsers.add_parser(\n        \"build\", help=\"Build a docker image for the model zoo.\"\n    )\n    zoo_build_parser.set_defaults(func=build_zoo)\n    args.add_zoo_build_params(zoo_build_parser)\n\n    # elasticdl zoo push\n    zoo_push_parser = zoo_subparsers.add_parser(\n        \"push\",\n        help=\"Push the docker image to a remote registry for the distributed\"\n        \"ElasticDL job.\",\n    )\n    zoo_push_parser.set_defaults(func=push_zoo)\n    args.add_zoo_push_params(zoo_push_parser)\n\n    # elasticdl train\n    train_parser = subparsers.add_parser(\n        \"train\", help=\"Submit a ElasticDL distributed training job\"\n    )\n    train_parser.set_defaults(func=train)\n    args.add_common_params(train_parser)\n    args.add_train_params(train_parser)\n\n    # elasticdl evaluate\n    evaluate_parser = subparsers.add_parser(\n        \"evaluate\", help=\"Submit a ElasticDL distributed evaluation job\"\n    )\n    evaluate_parser.set_defaults(func=evaluate)\n    args.add_common_params(evaluate_parser)\n    args.add_evaluate_params(evaluate_parser)\n\n    # elasticdl predict\n    predict_parser = subparsers.add_parser(\n        \"predict\", help=\"Submit a ElasticDL distributed prediction job\"\n    )\n    predict_parser.set_defaults(func=predict)\n    args.add_common_params(predict_parser)\n    args.add_predict_params(predict_parser)\n\n    return parser\n\n\ndef main():\n    parser = build_argument_parser()\n    if len(sys.argv) == 1:\n        parser.print_help(sys.stderr)\n        sys.exit(1)\n\n    try:\n        args, _ = parser.parse_known_args()\n    except TypeError:\n        parser.print_help(sys.stderr)\n        sys.exit(1)\n\n    args.func(args)\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "elasticdl_client/main.py"}]}