Some more complicate script:
#!/usr/bin/python
import time
from libnienet import *
# set enet device ip
host = "192.168.1.253"
l = 0
ud = 0
def connect():
global l
global ud
l = EnetLib(host)
# connect to device over GPIB/Ethernet
ud = l.ibdev(pad=15,sad=0, tmo=10, eot=1, eos=0) # primary address = 15 (GPIB)
# clear device
l.ibclr(ud)
# reset device
l.ibwrt(ud, "*RST")
# get device identification
l.ibwrt(ud, "*IDN?")
time.sleep(1)
[status, response] = l.ibrd(ud, 4096)
print "Device found: ", response
l.ibwrt(ud, ":DISP:WIND:TEXT:DATA '[url=http://WWW.118VOLT.IT;]WWW.118VOLT.IT;[/url]-)'")
l.ibwrt(ud, ":DISP:WIND2:TEXT:DATA 'go and visit it'")
l.ibwrt(ud, ":DISP:WIND:TEXT:STAT ON")
l.ibwrt(ud, ":DISP:WIND2:TEXT:STAT ON")
time.sleep(1)
# Setup Keithley 2001
l.ibwrt(ud, "*RST")
l.ibwrt(ud, "*CLR")
l.ibwrt(ud, ":SYST:AZER:TYPE SYNC")
l.ibwrt(ud, ":SYST:LSYN:STAT ON")
l.ibwrt(ud, ":SENS:FUNC 'VOLT:DC'")
l.ibwrt(ud, ":SENS:VOLT:DC:DIG 9; NPLC 10; AVER:COUN 50; TCON REP")
l.ibwrt(ud, ":SENS:VOLT:DC:AVER:STAT ON")
l.ibwrt(ud, ":SENS:VOLT:DC:RANG 20")
l.ibwrt(ud, ":FORM:ELEM READ")
l.ibwrt(ud, ":DISP:WIND:TEXT:DATA \" \";STAT ON;")
l.ibwrt(ud, ":DISP:WIND2:TEXT:DATA \" \";STAT ON;")
def disconnect():
global l
l.ibonl(ud, 1)
connect()
i = 0
while i <= 10000000:
try:
i+=1
l.ibwrt(ud, "READ?")
status = 0
while status <> 8448:
[status, response] = l.ibrd(ud, 4096)
time.sleep(0.1)
print time.strftime("%d/%m/%Y-%H:%M:%S ") + ("%2.7f" % (float(response)))
except:
print "ERROR!"
time.sleep(1)
disconnect()
connect()