args = parser.parse_args() error
Problem description
args = parser.parse_args() reports an error
import argparse
parser = argparse.ArgumentParser(prog='top', description='Show top lines from each file')
parser.add_argument('filenames', nargs='+')
parser.add_argument('-l', '--lines', type=int, default=10)
# args = parser.parse_args()
args, unknown = parser.parse_known_args() # Modified
print(args)
Solution:
Modify to args, unknown = parser.parse_known_args()
Read More:
- [Solved] UE4 Android Package Error: cmd.exe failed with args
- ROS Error: Roslaunch got a ‘No such file or directory‘ error while attempting to run xterm -e gdb –args
- Python TypeError: Unrecognized value type: <class ‘str‘>dateutil.parser._parser.ParserError: Unknow
- [Solved] Vue.js error: Module build failed: Error: No parser and no file path given, couldn’t infer a parser.
- How to parse JSON string in.Net [error reading job object from jsonreader. Current jsonreader item is not an obj]
- [Solved] python Error: GuessedAtParserWarning: No parser was explicitly specified
- How to Solve Svn upload so File Error
- How to Solve Error: RuntimeError: all tensors must be on devices[0]
- How to Solve Microsoft.CppCommon.targets(279,5): error MSB3073
- How to Solve Logstash error: failed to execute action
- How to Solve elasticsearch-7.15.1 operation errors
- How to Solve PyInstaller Package Error: ModuleNotFoundError: No module named ‘xxxx‘
- How to Solve Error “ImportError: cannot import name imsave“
- Python: How to Solve error While importing windpy
- How to Solve Error: Type mismatch: cannot convert from Object to Car
- How to Solve Error: Error no module “Tkinter”
- How to Solve Arxiv Upload with PDFLatex Error
- How to Solve Pychart configuration import torch error
- How to Solve ES error: “illegal_argument_exception”