Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Ben Fitzpatrick <benf <at> vxitech.com>
Subject: Function return types not getting set properly
Newsgroups: gmane.comp.python.pyvisa.devel
Date: Tuesday 19th June 2007 19:45:00 UTC (over 9 years ago)
Hi everyone,

We're seeing some unusual behavior as we try to use the vpp43 module
directly to
access quite a complicated instrument. Fortunately, the problem we're
seeing
appears relatively simple.

The symptom is that if, for example, we run the following code, where
"10.1.2.22" is not a device on our network:

import pyvisa.vpp43 as visa
defaultrm = visa.open_default_resource_manager()
foo = visa.open(defaultrm, "TCPIP::10.1.2.22::INSTR")

What we get is:
foo = 0L
visa.visa_status = 0

Which is clearly incorrect. Since the device doesn't exist, we should have
thrown a Visa IO Exception.

We tracked this down to the following code:
            try:
                self.__lib.__getattr__(visa_function).restype =
check_status

in vpp43. This code runs (we put in a print statement), but doesn't seem to
have
an effect:
visa.visa_library._VisaLibrary__lib.viOpen.restype


but if we then say:
visa.visa_library._VisaLibrary__lib.viOpen.restype = visa.check_status

We get the following:
visa.open(defaultrm, "TCPIP::10.1.2.22::INSTR")
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python25\lib\site-packages\pyvisa\vpp43.py", line 746, in open
    byref(vi))
  File "C:\Python25\lib\site-packages\pyvisa\vpp43.py", line 391, in
check_statu
s
    raise visa_exceptions.VisaIOError, status
pyvisa.visa_exceptions.VisaIOError: VI_ERROR_RSRC_NFOUND: Insufficient
location
information or the requested device or resource is not present in the
system.


Which appears to be correct. Any thoughts on how we could get that to work
on
import, or at least without doing it manually?

This is a default install of Python2.5 (problem happens identically on
Python2.4), with only the PyVisa and Swig packages installed. Any help
would be
appreciated.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
 
CD: 3ms