diff --git a/linux-gpib/language/python/gpibtest.py b/linux-gpib/language/python/gpibtest.py index 6050f42..a9ba3b1 100644 --- a/linux-gpib/language/python/gpibtest.py +++ b/linux-gpib/language/python/gpibtest.py @@ -10,7 +10,7 @@ v.write('D0 Q0') sleep(1) for i in range(0,10): - print v.read() + print(v.read()) diff --git a/linux-gpib/language/python/setup.py b/linux-gpib/language/python/setup.py index 839f14a..598bd15 100644 --- a/linux-gpib/language/python/setup.py +++ b/linux-gpib/language/python/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from distutils.core import setup,Extension setup(name="gpib", diff --git a/linux-gpib/language/python/srq_board.py b/linux-gpib/language/python/srq_board.py index ed70b81..b0f2175 100644 --- a/linux-gpib/language/python/srq_board.py +++ b/linux-gpib/language/python/srq_board.py @@ -17,10 +17,10 @@ def initialise_device(handle): # set up device to assert SRQ/RQS return def show_devid(handle): # Show device ID - print query(handle,"*IDN?") + print(query(handle,"*IDN?")) return -print gpib.version() # Show package version +print(gpib.version()) # Show package version ud = gpib.dev(board,device) # Open the device gpib.config(board,gpib.IbcTMO, gpib.T30s) # Set timeout to 30 seconds show_devid(ud); @@ -29,18 +29,18 @@ gpib.write(handle,"*TST;*OPC") # Initiate selftest and request OPC # Wait for Timeout or Service Request on board sta = gpib.wait(board, gpib.TIMO | gpib.SRQI) if (sta & gpib.TIMO) != 0: - print "Timed out" + print("Timed out") else: - print "SRQ asserted " + print("SRQ asserted ") # For each device which might pull SRQ stb = gpib.serial_poll(ud) # Read status byte - print "stb = %#x"%(stb) + print("stb = %#x"%(stb)) if (stb & gpib.IbStbRQS) != 0: # Check for RQS bit - print "Device asserted RQS" + print("Device asserted RQS") if (stb & gpib.IbStbESB) != 0: # Check for Event Status bit esr = int(query(ud,"ESR?")) # Read Event Status Register if (esr & 1) != 0: # Check for operation completed - print "Device Operation Completed" + print("Device Operation Completed") # done gpib.close(ud) diff --git a/linux-gpib/language/python/srq_device.py b/linux-gpib/language/python/srq_device.py index d05734c..1357ca6 100644 --- a/linux-gpib/language/python/srq_device.py +++ b/linux-gpib/language/python/srq_device.py @@ -17,10 +17,10 @@ def initialise_device(handle): # set up device to assert SRQ/RQS return def show_devid(handle): # Show device ID - print query(handle,"*IDN?") + print(query(handle,"*IDN?")) return -print gpib.version() # Show package version +print(gpib.version()) # Show package version ud = gpib.dev(board,device) # Open the device gpib.config(board,gpib.IbcAUTOPOLL,1) # Enable automatic serial polling gpib.config(ud,gpib.IbcTMO, gpib.T30s) # Set timeout to 30 seconds @@ -30,15 +30,15 @@ gpib.write(handle,"*TST;*OPC") # Selftest and request OPC event # Wait for Timeout or Request Service on device sta = gpib.wait(ud, gpib.TIMO | gpib.RQS) if (sta & gpib.TIMO) != 0: - print "Timed out" + print("Timed out") else: - print "Device asserted RQS" + print("Device asserted RQS") stb = gpib.serial_poll(ud) # Read status byte - print "stb = %#x"%(stb) + print("stb = %#x"%(stb)) if (stb & gpib.IbStbESB) != 0: # Check for Event Status bit esr = int(query(ud,"ESR?")) # Read Event Status Register if (esr & 1) != 0: # Check for operation completed - print "Device Operation Completed" + print("Device Operation Completed") # done gpib.close(ud) -- 2.25.2