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')
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/examples/network/vector_source.py24
1 files changed, 10 insertions, 14 deletions
diff --git a/gnuradio-runtime/examples/network/vector_source.py b/gnuradio-runtime/examples/network/vector_source.py
index c13b4b1d6f..cf8d0000c2 100755..100644
--- a/gnuradio-runtime/examples/network/vector_source.py
+++ b/gnuradio-runtime/examples/network/vector_source.py
@@ -20,10 +20,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
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 +34,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