summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/examples/network/vector_source.py
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-runtime/examples/network/vector_source.py')
-rwxr-xr-xgnuradio-runtime/examples/network/vector_source.py23
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