commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 06/20: python3: update gr-blocks python fil


From: git
Subject: [Commit-gnuradio] [gnuradio] 06/20: python3: update gr-blocks python files for python3 support
Date: Sun, 25 Dec 2016 03:59:57 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch python3
in repository gnuradio.

commit fb86bf6545bba4e06bc352679978992076bc9644
Author: Douglas Anderson <address@hidden>
Date:   Thu Dec 22 12:51:08 2016 -0700

    python3: update gr-blocks python files for python3 support
---
 gr-blocks/examples/tags/test_file_tags.py      |  6 +++---
 gr-blocks/python/blocks/parse_file_metadata.py | 26 ++++++++++++++------------
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/gr-blocks/examples/tags/test_file_tags.py 
b/gr-blocks/examples/tags/test_file_tags.py
index cc11cf5..c365fd9 100755
--- a/gr-blocks/examples/tags/test_file_tags.py
+++ b/gr-blocks/examples/tags/test_file_tags.py
@@ -20,6 +20,8 @@
 # Boston, MA 02110-1301, USA.
 #
 
+from __future__ import print_function
+
 from gnuradio import gr
 from gnuradio import blocks
 import sys
@@ -27,7 +29,7 @@ import sys
 try:
     import scipy
 except ImportError:
-    print "Error: Program requires scipy (see: www.scipy.org)."
+    print("Error: Program requires scipy (see: www.scipy.org).")
     sys.exit(1)
 
 def main():
@@ -52,5 +54,3 @@ def main():
 
 if __name__ == "__main__":
     main()
-
-
diff --git a/gr-blocks/python/blocks/parse_file_metadata.py 
b/gr-blocks/python/blocks/parse_file_metadata.py
index 7d8d41d..4a97ed7 100644
--- a/gr-blocks/python/blocks/parse_file_metadata.py
+++ b/gr-blocks/python/blocks/parse_file_metadata.py
@@ -20,6 +20,8 @@
 # Boston, MA 02110-1301, USA.
 #
 
+from __future__ import print_function
+
 import sys
 from gnuradio import gr, blocks
 import pmt
@@ -65,7 +67,7 @@ def parse_header(p, VERBOSE=False):
         r = pmt.dict_ref(p, pmt.string_to_symbol("version"), dump)
         version = pmt.to_long(r)
         if(VERBOSE):
-            print "Version Number: {0}".format(version)
+            print("Version Number: {0}".format(version))
     else:
         sys.stderr.write("Could not find key 'version': invalid or corrupt 
data file.\n")
         sys.exit(1)
@@ -76,7 +78,7 @@ def parse_header(p, VERBOSE=False):
         samp_rate = pmt.to_double(r)
         info["rx_rate"] = samp_rate
         if(VERBOSE):
-            print "Sample Rate: {0:.2f} sps".format(samp_rate)
+            print("Sample Rate: {0:.2f} sps".format(samp_rate))
     else:
         sys.stderr.write("Could not find key 'sr': invalid or corrupt data 
file.\n")
         sys.exit(1)
@@ -91,7 +93,7 @@ def parse_header(p, VERBOSE=False):
         t = secs + fracs
         info["rx_time"] = t
         if(VERBOSE):
-            print "Seconds: {0:.6f}".format(t)
+            print("Seconds: {0:.6f}".format(t))
     else:
         sys.stderr.write("Could not find key 'time': invalid or corrupt data 
file.\n")
         sys.exit(1)
@@ -102,7 +104,7 @@ def parse_header(p, VERBOSE=False):
         dsize = pmt.to_long(r)
         info["size"] = dsize
         if(VERBOSE):
-            print "Item size: {0}".format(dsize)
+            print("Item size: {0}".format(dsize))
     else:
         sys.stderr.write("Could not find key 'size': invalid or corrupt data 
file.\n")
         sys.exit(1)
@@ -114,7 +116,7 @@ def parse_header(p, VERBOSE=False):
         stype = ftype_to_string[dtype]
         info["type"] = stype
         if(VERBOSE):
-            print "Data Type: {0} ({1})".format(stype, dtype)
+            print("Data Type: {0} ({1})".format(stype, dtype))
     else:
         sys.stderr.write("Could not find key 'type': invalid or corrupt data 
file.\n")
         sys.exit(1)
@@ -125,7 +127,7 @@ def parse_header(p, VERBOSE=False):
         cplx = pmt.to_bool(r)
         info["cplx"] = cplx
         if(VERBOSE):
-            print "Complex? {0}".format(cplx)
+            print("Complex? {0}".format(cplx))
     else:
         sys.stderr.write("Could not find key 'cplx': invalid or corrupt data 
file.\n")
         sys.exit(1)
@@ -138,9 +140,9 @@ def parse_header(p, VERBOSE=False):
         info["extra_len"] = seg_start - HEADER_LENGTH
         info["has_extra"] = info["extra_len"] > 0
         if(VERBOSE):
-            print "Header Length: {0} bytes".format(info["hdr_len"])
-            print "Extra Length:  {0}".format((info["extra_len"]))
-            print "Extra Header?  {0}".format(info["has_extra"])
+            print("Header Length: {0} bytes".format(info["hdr_len"]))
+            print("Extra Length:  {0}".format((info["extra_len"])))
+            print("Extra Header?  {0}".format(info["has_extra"]))
     else:
         sys.stderr.write("Could not find key 'strt': invalid or corrupt data 
file.\n")
         sys.exit(1)
@@ -155,8 +157,8 @@ def parse_header(p, VERBOSE=False):
         info["nbytes"] = nbytes
 
         if(VERBOSE):
-            print "Size of Data: {0} bytes".format(nbytes)
-            print "              {0} items".format(nitems)
+            print("Size of Data: {0} bytes".format(nbytes))
+            print("              {0} items".format(nitems))
     else:
         sys.stderr.write("Could not find key 'size': invalid or corrupt data 
file.\n")
         sys.exit(1)
@@ -177,6 +179,6 @@ def parse_extra_dict(p, info, VERBOSE=False):
         val = pmt.cdr(item)
         info[key] = val
         if(VERBOSE):
-            print "{0}: {1}".format(key, val)
+            print("{0}: {1}".format(key, val))
 
     return info



reply via email to

[Prev in Thread] Current Thread [Next in Thread]