Skip to content

Commit bf493a5

Browse files
committed
[xmlparser] Replace deprecated optparse
1 parent 1c330fe commit bf493a5

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

odml/tools/xmlparser.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -517,13 +517,14 @@ def parse_property(self, root, fmt):
517517

518518

519519
if __name__ == '__main__':
520-
from optparse import OptionParser
520+
import argparse
521521
import odml.tools.dumper as dumper
522522

523-
parser = OptionParser()
524-
(options, args) = parser.parse_args()
523+
args = sys.argv[1:]
525524

526-
if len(args) < 1:
527-
parser.print_help()
528-
else:
529-
dumper.dump_doc(load(args[0]))
525+
desc = "Print content of an odml xml file to the stdout"
526+
parser = argparse.ArgumentParser(description=desc)
527+
parser.add_argument("odml_file", help="Path to odml xml file")
528+
args = parser.parse_args(args)
529+
530+
dumper.dump_doc(load(args.odml_file))

0 commit comments

Comments
 (0)