(PYVMS LOGO) Python on OpenVMS

(go to: table of contents, index, list of vms_lib, prev: DIGIT_SEP, next: FID_TO_NAME)


DO_COMMAND - Execute Command


This routine immediately stops the program executing (Python). Python is not able to do any cleanup!

Format:

    vms_lib.do_command (command-string)
Returns:

There is no data returned. DO_COMMAND will terminate the current Python session and then execute 'command-string'! However, when something is wrong, then DO_COMMAND raises an exception - see the examples below.

Arguments:

command-string
The DCL command string. Its length is limited to 255 characters. Otherwise the exception 'vms_lib.error' is raised.
Examples:
>>> import vms_lib

>>> vms_lib.do_command ('SHOW TIME')
  15-MAR-1996 20:37:25
$! Python was left and then the DCL command executed

>>> command_string = 'C' * 257
>>> vms_lib.do_command (command_string)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_lib.error: (1409588, '%LIB-F-INVARG, invalid argument(s)')
>>> # an exception was raised, but Python was not aborted, here

>>> command_string = 'C' * 65536
>>> vms_lib.do_command (command_string)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: argument 1: command - string size limited to 65535 characters
>>> # an exception was raised, but Python was not aborted, here

>>> vms_lib.do_command ('INVALID_COMMAND')
%DCL-W-IVVERB, unrecognized command verb - check validity and spelling
 \INVALID_COMMAND\
$! Python was left although the DCL command is invalid!

(go to: table of contents, index, list of vms_lib, prev: DIGIT_SEP, next: FID_TO_NAME)

02-DEC-1998 ZE.