1. Simple scpi using PyVisa
In [1]:
import visa
scope = visa.instrument("TCPIP0::130.30.240.155::inst0::INSTR")
scope.ask("*idn?")
Out[1]:
'Agilent Technologies,MSOX93204A,MY53240105,04.60.0016'
  1. Using SCPI.NET dll from Command Expert (Assumes Python for .NET dll's & spci.net dll copied into Python dirs)
In [1]:
import clr
clr.AddReference("AgInfiniium90000_04_00_0004")
from Agilent.CommandExpert.ScpiNet.AgInfiniium90000_04_00_0004 import *
scope = AgInfiniium90000("TCPIP0::localhost::inst0::INSTR")
idn = ""
idn = scope.SCPI.IDN.Query(idn)
---------------------------------------------------------------------------
CommunicationException                    Traceback (most recent call last)
<ipython-input-1-285435e77dea> in <module>()
      2 clr.AddReference("AgInfiniium90000_04_00_0004")
      3 from Agilent.CommandExpert.ScpiNet.AgInfiniium90000_04_00_0004 import *
----> 4 scope = AgInfiniium90000("TCPIP0::localhost::inst0::INSTR")
      5 idn = ""
      6 idn = scope.SCPI.IDN.Query(idn)

CommunicationException: A VISA COM error occurred (HRESULT = 80040000)
   at Agilent.CommandExpert.Scpi.Connections.VisaScpiConnection.a(COMException A_0)
   at Agilent.CommandExpert.Scpi.Connections.VisaScpiConnection.OpenConnectionInternal()
   at Agilent.CommandExpert.Scpi.Connections.BaseScpiConnection.OpenConnection(ScpiExecution parent)
   at Agilent.CommandExpert.Scpi.ScpiExecution.Connect()
   at Agilent.CommandExpert.ScpiNet.AgInfiniium90000_04_00_0004.AgInfiniium90000.Initialize(ISource rh)
   at Agilent.CommandExpert.ScpiNet.AgInfiniium90000_04_00_0004.AgInfiniium90000..ctor(String location, Int32 timeout)
   at Agilent.CommandExpert.ScpiNet.AgInfiniium90000_04_00_0004.AgInfiniium90000..ctor(String location)
In [4]:
scope.SCPI.IDN.
Out[4]:
u'Agilent Technologies,N8900A,No Serial,04.99.201402240'
  1. Test DocStringAttribute in .NET dll
In [1]:
import sys
#sys.path.append("C:\Users\marnj\Documents\Visual Studio 2012\Projects\myDll\myDll\bin\Debug")
import clr
#clr.FindAssembly("myDll")
clr.AddReference(u"C:\\Users\\marnj\\Documents\\Visual Studio 2012\\Projects\\myDll\\myDll\\bin\\Debug\\myDll")
from myDll import mycalc
In [2]:
myinst = mycalc()
In [3]:
myinst.Add(
In [7]:
myinst.__doc__
Out[7]:
'Void .ctor()'
In [ ]: