diff tek2024b_example.py @ 56:91b476ebc0f2

Run through 2to3
author Daniel O'Connor <doconnor@gsoft.com.au>
date Tue, 08 Dec 2020 14:00:45 +1030
parents 9bb8a9f3df6b
children
line wrap: on
line diff
--- a/tek2024b_example.py	Tue Dec 08 13:59:05 2020 +1030
+++ b/tek2024b_example.py	Tue Dec 08 14:00:45 2020 +1030
@@ -33,7 +33,7 @@
 
 def test(u):
     u.write("*IDN?")
-    print "IDN reports " + u.read()
+    print("IDN reports " + u.read())
     
     # Set data format to 16 bit big endian signed
     u.write("DATA:ENC RIB")
@@ -48,12 +48,12 @@
     # Fetch channel scale
     u.write("CH1:SCALE?")
     vscale = float(u.read(1).split()[1])
-    print "Channel 1 scale is %.2f volts/div" % (vscale)
+    print("Channel 1 scale is %.2f volts/div" % (vscale))
 
     # Fetch horizontal scale
     u.write("HOR:MAIN:SCALE?")
     hscale = scpi.getdata(u.read())
-    print "Horizontal scale is %f nsec/div" % (hscale * 1e9)
+    print("Horizontal scale is %f nsec/div" % (hscale * 1e9))
 
     # Make sure the previous commands have been executed
     u.write("*WAI")
@@ -63,7 +63,7 @@
     then = time.time()                            
     result = u.read(1.0)
     now = time.time()
-    print "CURVE read took %f milliseconds" % ((now - then) * 1000.0)
+    print("CURVE read took %f milliseconds" % ((now - then) * 1000.0))
 
     # Parse data
     ary = scpi.bindecode(result, dtype = numpy.dtype('>h'))
@@ -77,6 +77,6 @@
     
 if __name__ == "__main__":
     u = usb488.USB488Device()
-    print "Found device"
+    print("Found device")
 
     test(u)