Constants module

Provides user-friendly naming to values used in different functions.

class pyvisa.constants.AccessModes[source]

Whether and how to lock a resource when opening a connection.

exclusive_lock = 1

Obtains a exclusive lock on the VISA resource.

no_lock = 0

Does not obtain any lock on the VISA resource.

shared_lock = 2

Obtains a lock on the VISA resouce which may be shared between multiple VISA sessions.

class pyvisa.constants.StopBits[source]

The number of stop bits that indicate the end of a frame on a serial resource.

Used only for ASRL resources.

one = 10
one_and_a_half = 15
two = 20
class pyvisa.constants.Parity[source]

Parity type to use with every frame transmitted and received on a serial session.

Used only for ASRL resources.

even = 2
mark = 3
none = 0
odd = 1
space = 4
class pyvisa.constants.SerialTermination[source]

The available methods for terminating a serial transfer.

last_bit = 1

The transfer occurs with the last bit not set until the last character is sent.

none = 0

The transfer terminates when all requested data is transferred or when an error occurs.

termination_break = 3

The write transmits a break after all the characters for the write are sent.

termination_char = 2

The transfer terminate by searching for “/” appending the termination character.

class pyvisa.constants.InterfaceType[source]

The hardware interface.

asrl = 4

Serial devices connected to either an RS-232 or RS-485 controller.

firewire = 9

Firewire device.

gpib = 1

GPIB Interface.

gpib_vxi = 3

GPIB VXI (VME eXtensions for Instrumentation).

pxi = 5

PXI device.

rio = 8

Rio device.

rsnrp = 33024

Rohde and Schwarz Device via Passport

tcpip = 6

TCPIP device.

unknown = -1
usb = 7

Universal Serial Bus (USB) hardware bus.

vxi = 2

VXI (VME eXtensions for Instrumentation), VME, MXI (Multisystem eXtension Interface).

class pyvisa.constants.AddressState[source]

State of a GPIB resource.

Corresponds to the Attribute.GPIB_address_state attribute

listenr = 2

The resource is addressed to listen

talker = 1

The resource is addressed to talk

unaddressed = 0

The resource is unadressed

class pyvisa.constants.IOProtocol[source]

IO protocol used for communication.

See attributes.AttrVI_ATTR_IO_PROT for more details.

fdc = 2

Fast data channel (FDC) protocol for VXI

hs488 = 3

High speed 488 transfer for GPIB

normal = 1
protocol4882_strs = 4

488 style transfer for serial

usbtmc_vendor = 5

Test measurement class vendor specific for USB

class pyvisa.constants.LineState[source]

State of a hardware line or signal.

The line for which the state can be queried are: - ASRC resource: BREAK, CTS, DCD, DSR, DTR, RI, RTS signals - GPIB resources: ATN, NDAC, REN, SRQ lines - VXI BACKPLANE: VXI/VME SYSFAIL backplane line

Search for LineState in for more details.

asserted = 1

The line/signal is currently asserted

unasserted = 0

The line/signal is currently deasserted

unknown = -1

The state of the line/signal is unknown

class pyvisa.constants.StatusCode[source]

Status codes that VISA driver-level operations can return.

error_abort = -1073807312

The operation was aborted.

error_allocation = -1073807300

Insufficient system resources to perform necessary memory allocation.

error_attribute_read_only = -1073807329

The specified attribute is read-only.

error_bus_error = -1073807304

Bus error occurred during transfer.

error_closing_failed = -1073807338

Unable to deallocate the previously allocated data structures corresponding to this session or object reference.

error_connection_lost = -1073807194

The connection for the specified session has been lost.

error_file_access = -1073807199

An error occurred while trying to open the specified file. Possible causes include an invalid path or lack of access rights.

error_file_i_o = -1073807198

An error occurred while performing I/O on the specified file.

error_handler_not_installed = -1073807320

A handler is not currently installed for the specified event.

error_in_progress = -1073807303

Unable to queue the asynchronous operation because there is already an operation in progress.

error_input_protocol_violation = -1073807305

Device reported an input protocol error during transfer.

error_interface_number_not_configured = -1073807195

The interface type is valid but the specified interface number is not configured.

error_interrupt_pending = -1073807256

An interrupt is still pending from a previous call.

error_invalid_access_key = -1073807327

The access key to the resource associated with this session is invalid.

error_invalid_access_mode = -1073807341

Invalid access mode.

error_invalid_address_space = -1073807282

Invalid address space specified.

error_invalid_context = -1073807318

Specified event context is invalid.

error_invalid_degree = -1073807333

Specified degree is invalid.

error_invalid_event = -1073807322

Specified event type is not supported by the resource.

error_invalid_expression = -1073807344

Invalid expression specified for search.

error_invalid_format = -1073807297

A format specifier in the format string is invalid.

error_invalid_handler_reference = -1073807319

The specified handler reference is invalid.

error_invalid_job_i_d = -1073807332

Specified job identifier is invalid.

error_invalid_length = -1073807229

Invalid length specified.

error_invalid_line = -1073807200

The value specified by the line parameter is invalid.

error_invalid_lock_type = -1073807328

The specified type of lock is not supported by this resource.

error_invalid_mask = -1073807299

Invalid buffer mask specified.

error_invalid_mechanism = -1073807321

Invalid mechanism specified.

error_invalid_mode = -1073807215

The specified mode is invalid.

error_invalid_object = -1073807346

The specified session or object reference is invalid.

error_invalid_offset = -1073807279

Invalid offset specified.

error_invalid_parameter = -1073807240

The value of an unknown parameter is invalid.

error_invalid_protocol = -1073807239

The protocol specified is invalid.

error_invalid_resource_name = -1073807342

Invalid resource reference specified. Parsing error.

error_invalid_setup = -1073807302

Unable to start operation because setup is invalid due to inconsistent state of properties.

error_invalid_size = -1073807237

Invalid size of window specified.

error_invalid_width = -1073807278

Invalid source or destination width specified.

error_io = -1073807298

Could not perform operation because of I/O error.

error_library_not_found = -1073807202

A code library required by VISA could not be located or loaded.

error_line_in_use = -1073807294

The specified trigger line is currently in use.

error_machine_not_available = -1073807193

The remote machine does not exist or is not accepting any connections.

error_memory_not_shared = -1073807203

The device does not export any memory.

error_no_listeners = -1073807265

No listeners condition is detected (both NRFD and NDAC are deasserted).

error_no_permission = -1073807192

Access to the remote machine is denied.

error_nonimplemented_operation = -1073807231

The specified operation is unimplemented.

error_nonsupported_attribute = -1073807331

The specified attribute is not defined or supported by the referenced session, event, or find list.

error_nonsupported_attribute_state = -1073807330

The specified state of the attribute is not valid or is not supported as defined by the session, event, or find list.

error_nonsupported_format = -1073807295

A format specifier in the format string is not supported.

error_nonsupported_interrupt = -1073807201

The interface cannot generate an interrupt on the requested level or with the requested statusID value.

error_nonsupported_line = -1073807197

The specified trigger source line (trigSrc) or destination line (trigDest) is not supported by this VISA implementation, or the combination of lines is not a valid mapping.

error_nonsupported_mechanism = -1073807196

The specified mechanism is not supported for the specified event type.

error_nonsupported_mode = -1073807290

The specified mode is not supported by this VISA implementation.

error_nonsupported_offset = -1073807276

Specified offset is not accessible from this hardware.

error_nonsupported_offset_alignment = -1073807248

The specified offset is not properly aligned for the access width of the operation.

error_nonsupported_operation = -1073807257

The session or object reference does not support this operation.

error_nonsupported_varying_widths = -1073807275

Cannot support source and destination widths that are different.

error_nonsupported_width = -1073807242

Specified width is not supported by this hardware.

error_not_cic = -1073807264

The interface associated with this session is not currently the Controller-in-Charge.

error_not_enabled = -1073807313

The session must be enabled for events of the specified type in order to receive them.

error_not_system_controller = -1073807263

The interface associated with this session is not the system controller.

error_output_protocol_violation = -1073807306

Device reported an output protocol error during transfer.

error_queue_error = -1073807301

Unable to queue asynchronous operation.

error_queue_overflow = -1073807315

The event queue for the specified type has overflowed, usually due to not closing previous events.

error_raw_read_protocol_violation = -1073807307

Violation of raw read protocol occurred during transfer.

error_raw_write_protocol_violation = -1073807308

Violation of raw write protocol occurred during transfer.

error_resource_busy = -1073807246

The resource is valid, but VISA cannot currently access it.

error_resource_locked = -1073807345

Specified type of lock cannot be obtained or specified operation cannot be performed because the resource is locked.

error_resource_not_found = -1073807343

Insufficient location information, or the device or resource is not present in the system.

error_response_pending = -1073807271

A previous response is still pending, causing a multiple query error.

error_serial_framing = -1073807253

A framing error occurred during transfer.

error_serial_overrun = -1073807252

An overrun error occurred during transfer. A character was not read from the hardware before the next character arrived.

error_serial_parity = -1073807254

A parity error occurred during transfer.

error_session_not_locked = -1073807204

The current session did not have any lock on the resource.

error_srq_not_occurred = -1073807286

Service request has not been received for the session.

error_system_error = -1073807360

Unknown system error.

error_timeout = -1073807339

Timeout expired before operation completed.

error_trigger_not_mapped = -1073807250

The path from the trigger source line (trigSrc) to the destination line (trigDest) is not currently mapped.

error_user_buffer = -1073807247

A specified user buffer is not valid or cannot be accessed for the required size.

error_window_already_mapped = -1073807232

The specified session currently contains a mapped window.

error_window_not_mapped = -1073807273

The specified session is currently unmapped.

success = 0

Operation completed successfully.

success_device_not_present = 1073676413

Session opened successfully, but the device at the specified address is not responding.

success_event_already_disabled = 1073676291

Specified event is already disabled for at least one of the specified mechanisms.

success_event_already_enabled = 1073676290

Specified event is already enabled for at least one of the specified mechanisms.

success_max_count_read = 1073676294

The number of bytes read is equal to the input count.

success_nested_exclusive = 1073676442

Operation completed successfully, and this session has nested exclusive locks.

success_nested_shared = 1073676441

Operation completed successfully, and this session has nested shared locks.

success_no_more_handler_calls_in_chain = 1073676440

Event handled successfully. Do not invoke any other handlers on this session for this event.

success_queue_already_empty = 1073676292

Operation completed successfully, but the queue was already empty.

success_queue_not_empty = 1073676416

Wait terminated successfully on receipt of an event notification. There is still at least one more event occurrence of the requested type(s) available for this session.

success_synchronous = 1073676443

Asynchronous operation request was performed synchronously.

success_termination_character_read = 1073676293

The specified termination character was read.

success_trigger_already_mapped = 1073676414

The path from the trigger source line (trigSrc) to the destination line (trigDest) is already mapped.

warning_configuration_not_loaded = 1073676407

The specified configuration either does not exist or could not be loaded. The VISA-specified defaults are used.

warning_ext_function_not_implemented = 1073676457

The operation succeeded, but a lower level driver did not implement the extended functionality.

warning_nonsupported_attribute_state = 1073676420

Although the specified state of the attribute is valid, it is not supported by this resource implementation.

warning_nonsupported_buffer = 1073676424

The specified buffer is not supported.

warning_null_object = 1073676418

The specified object reference is uninitialized.

warning_queue_overflow = 1073676300

VISA received more event information of the specified type than the configured queue size could hold.

warning_unknown_status = 1073676421

The status code passed to the operation could not be interpreted.