Contact an Expert

Thread: Python Scripting

Permlink Replies: 2 - Pages: 1 - Last Post: Sep 9, 2014 7:01 AM Last Post By: gilbachar

Posts: 11
Registered: 01/16/12
Python Scripting
Posted: Apr 25, 2012 5:47 AM
Click to report abuse...   Click to reply to this thread Reply
Any Manuals for the scripting in Python

Posts: 37
Registered: 06/08/09
Re: Python Scripting
Posted: Apr 25, 2012 11:19 AM   in response to: varuniyengar in response to: varuniyengar
Click to report abuse...   Click to reply to this thread Reply
Work is planned to expand the Python Scriptin documentation beyond what is currentlyu available in the product documentation. There are also a number of example Python scripts that are today supplied with the product (See Scipting Demo entry in the help menu).

In case of help on a specific functionality that is not covered with the available material, please contact support.

Posts: 1
Registered: 09/09/14
Re: Python Scripting
Posted: Sep 9, 2014 7:01 AM   in response to: janvh in response to: janvh
Click to report abuse...   Click to reply to this thread Reply
hallow ...

i have a problem on python and c script.
i try to automatic test Agilent DC power supply on python or c script,
but python and c script do not recognize "GPIB0::2::INSTR"

my computer plug to the power supply via NI GPIB cable
i have connection in the Agilent app ('GPIB0::2::INSTR') but not on my scripts

my os is win 7 64_bit
i have visa drivers
i have NI drivres, connection expert app and NI IO trace app
python 2.7 (IDLE for win 7)
pyvisa lib

ython 2.7.8 (default, Jun 30 2014, 16:03:49) http://MSC v.1500 32 bit (Intel) on win32
Type "copyright", "credits" or "license()" for more information.

import visa
rm = visa.ResourceManager()
osci = rm.open_resource('GPIB0::2::INSTR')

Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
osci = rm.open_resource('GPIB0::2::INSTR')
File "C:\Python27\lib\site-packages\pyvisa\", line 300, in open_resource
return, resource_name, access_mode, open_timeout)
File "C:\Python27\lib\site-packages\pyvisa\ctwrapper\", line 1059, in open
library.viOpen(session, resource_name, access_mode, open_timeout, byref(out_session))
File "C:\Python27\lib\site-packages\pyvisa\", line 171, in _return_handler
raise errors.VisaIOError(ret_value)
VisaIOError: VI_ERROR_LIBRARY_NFOUND (-1073807202): A code library required by VISA could not be located or loaded.

This example program queries a GPIB device for an identification string
and prints the results. Note that you must change the address. */
//#include "sicl.h"
#include <visa.h>
#include <stdio.h>

void main () {

ViSession defaultRM, vi;
char buf 256 = {0};

/* Open session to GPIB device at address 22 */
viOpenDefaultRM (&defaultRM);
printf("calling viOpen...\r\n");
viOpen (defaultRM, "GPIB::2::INSTR", VI_NULL,VI_NULL, &vi);

/* Initialize device */
viPrintf (vi, "*RST\n");

/* Send an *IDN? string to the device */
viPrintf (vi, "*IDN?");

/* Read results */
viScanf (vi, "%t", &buf);

/* Print results */
printf ("Instrument identification string: %s\n", &buf);

/* Close session */
viClose (vi);
viClose (defaultRM);

after compile and exequte the c file, the output :

Instrument identification string: []

Point your RSS reader here for a feed of the latest messages in all forums