[Tutor] PyVISA GPIB

Blockheads Oi Oi breamoreboy at yahoo.co.uk
Fri Apr 1 19:16:34 CEST 2011


On 01/04/2011 18:00, Donald Bedsole wrote:
> Hi Mark,
>
> On Fri, Apr 1, 2011 at 11:42 AM,<markrivet at gsoftcon.com>  wrote:
>>   I would like to control electronic instruments with PyVISA. I have downloaded PyVISA and unpacked the files into the Python27/lib/site-packages dir and in the IDLE
>> GUI I run "import visa' for a quick check and I get this error:
>>
>> import visa
>>
>> Traceback (most recent call last):
>>   File "<pyshell#25>", line 1, in<module>
>>     import visa
>> ImportError: No module named visa
>>
>> I'm scratching my head. Help
>>
>> Mark R Rivet, Genesis Software Consulting
>> ASCT(Computer Technologies), BSIT/SE(Software Engineering)
>> Electrical Engineering Technician
>> Member IEEE, Computer Society
>>
>>
>> Do or do not; there is no try.
>
> Could this be the problem?

No.  The problem above is at a higher level.  This is what you get at a 
lower level trying to import the code.  At least I think so :)

c:\Users\Mark\Cashflow\Python>python -V
Python 2.7.1

c:\Users\Mark\Cashflow\Python>python -c "import visa"
Traceback (most recent call last):
   File "<string>", line 1, in <module>
   File "c:\python27\lib\site-packages\visa.py", line 1, in <module>
     from pyvisa.visa import *
   File "c:\python27\lib\site-packages\pyvisa\visa.py", line 231, in 
<module>
     resource_manager = ResourceManager()
   File "c:\python27\lib\site-packages\pyvisa\vpp43.py", line 105, in 
__new__
     it.init(*args, **kwds)
   File "c:\python27\lib\site-packages\pyvisa\visa.py", line 227, in init
     self.session = self.vi = vpp43.open_default_resource_manager()
   File "c:\python27\lib\site-packages\pyvisa\vpp43.py", line 758, in 
open_default_resource_manager
     visa_library().viOpenDefaultRM(byref(session))
   File "c:\python27\lib\site-packages\pyvisa\vpp43.py", line 175, in 
__call__
     self.load_library()
   File "c:\python27\lib\site-packages\pyvisa\vpp43.py", line 141, in 
load_library
     self.__lib       = windll.visa32
   File "c:\python27\lib\ctypes\__init__.py", line 423, in __getattr__
     dll = self._dlltype(name)
   File "c:\python27\lib\ctypes\__init__.py", line 353, in __init__
     self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found

>
> PyVISA doesn’t implement VISA itself. Instead, PyVISA provides
> bindings to the VISA library (a DLL or
> “shared object” file). This library is usually shipped with your GPIB
> interface or software like LabVIEW. Alternatively, you can download it
> from your favourite equipment vendor (National Instruments, Agilent,
> etc).
>
> quote from this document:
>
> http://pyvisa.sourceforge.net/pyvisa.pdf
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

Cheers.

Mark L.




More information about the Tutor mailing list