diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2016-11-17 21:20:55 +0100 |
---|---|---|
committer | Sebastian Koslowski <koslowski@kit.edu> | 2016-11-17 21:21:08 +0100 |
commit | 7f25c0120fc7bc6a6eeee87878cf387647d51614 (patch) | |
tree | ab510060a2c5625d00e7f19f4c7d699861b98cea /gnuradio-runtime/examples/network/vector_source.py | |
parent | e1acf2d27760d606cc7cba200aa380e885f2ffaf (diff) | |
parent | 1d50d70f0b990b909357a803881955623dea94d8 (diff) |
Merge remote-tracking branch 'upstream/next' into gtk3
Diffstat (limited to 'gnuradio-runtime/examples/network/vector_source.py')
-rwxr-xr-x | gnuradio-runtime/examples/network/vector_source.py | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/gnuradio-runtime/examples/network/vector_source.py b/gnuradio-runtime/examples/network/vector_source.py index c13b4b1d6f..be40134bc0 100755 --- a/gnuradio-runtime/examples/network/vector_source.py +++ b/gnuradio-runtime/examples/network/vector_source.py @@ -22,8 +22,7 @@ from gnuradio import gr from gnuradio import blocks -from gnuradio.eng_option import eng_option -from optparse import OptionParser +from argparse import ArgumentParser class vector_source(gr.top_block): def __init__(self, host, port, pkt_size, eof): @@ -34,23 +33,19 @@ class vector_source(gr.top_block): self.connect(vec, udp) if __name__ == '__main__': - parser = OptionParser(option_class=eng_option) - parser.add_option("", "--host", type="string", default="127.0.0.1", + parser = ArgumentParser() + parser.add_argument("--host", default="127.0.0.1", help="Remote host name (domain name or IP address") - parser.add_option("", "--port", type="int", default=65500, + parser.add_argument("--port", type=int, default=65500, help="port number to connect to") - parser.add_option("", "--packet-size", type="int", default=1471, + parser.add_argument("--packet-size", type=int, default=1471, help="packet size.") - parser.add_option("", "--no-eof", action="store_true", default=False, + parser.add_argument("--no-eof", action="store_true", default=False, help="don't send EOF on disconnect") - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - + args = parser.parse_args() # Create an instance of a hierarchical block - top_block = vector_source(options.host, options.port, options.packet_size, - not options.no_eof) + top_block = vector_source(args.host, args.port, args.packet_size, + not args.no_eof) try: # Run forever |