(LOGO.JPG) Python for OpenVMS

(go to: table of contents, index, prev: embedding the Python interpreter, next: changes to Python source)

This section explains changes to modules of the Python library that have been made to support OpenVMS.

compileall

is used to pre-compile all modules of the Python library.

The default OpenVMS filesystem (ODS-2) supports only uppercase filenames. The modification makes the module compliant.

This module is used during the installation. See the 'Installation Manual', 'installing and building', 'compile Python files'.

ftplib

The arguments of 2 calls to makefile() have been changed from 'rb' to 'r'. Only the following tests have been done:
>>> import ftplib
>>> ftp = ftplib.FTP ('host', 'username', 'password')
>>> ftp.retrlines ('LIST')
...
'226 LIST Directory transfer complete.'
>>>


$ set DEFAULT PYTHON_VMS:
$ set DEFAULT [-.LIB]
$ python ftplib.py -d localhost -l -p -l
*cmd* 'USER anonymous'
*resp* '331 Guest login ok, send ident as password.'
*cmd* 'PASS *************************'
*resp* '530 Username ANONYMOUS has been disabled.'
Traceback (innermost last):
[...]
  File "ftplib.py", line 201, in getresp
    raise error_perm, resp
ftplib.error_perm: 530 Username ANONYMOUS has been disabled.
$
Problems might remain.

getpass

is used to accept a password from the terminal without echoing. The 'getuser()' method can be called to return the username.

GETPASS.PY has been modified to call pyvms.pylib_getpass() on OpenVMS systems.

site

The change only affects output when the user has entered 'exit' or 'quit' at the interactive interpreter prompt.

Old:
>>> exit
'Use Ctrl-D (i.e. EOF) to exit.'
>>>

Now:
>>> exit
'Use Ctrl-Z (i.e. EOF) to exit.'
>>>

This module has more functionality, but that has not been changed for OpenVMS.

tempfile

is used to create 'temporary' filenames and possibly open temporary files.

The module was using a filename character ("@") that is invalid on ODS-2 disks.

The 'TemporaryFileWrapper' class uses a construct (os.open(), os.unlink()) that does not work on OpenVMS. The port pretends to be a 'POSIX' environment, so the appropriate check fails. The check has been removed - the required piece of code is directly executed.

Beginning with version 1.5.2-V007 there is no '.' in the temporary name, because the 'TEST_PKG.PY' uses this module to create temporary directory names. (On a Unix system there is no fixed 'type' for a directory as on OpenVMS where this is always '.DIR;1'.)

The '/tmp' directory is handled by some code that translates the logical name "PYTHON_TMP2" which is defined by the procedure SETUP.COM.

SETUP.COM creates a subdirectory "[.PYTHON_TMP]" within the directory that the logical name "SYS$SCRATCH" points to.

>>> import tempfile
>>>
>>> tempfile.gettempdir ()
'/user_here/zessin/python_tmp'
>>> tempfile.gettempprefix ()
'python_tmp_213_'
>>> tempfile.mktemp ()
'/user_here/zessin/python_tmp/python_tmp_213_1'
>>> tempfile._pid
213
>>> tempfile.counter
1
>>>

$ show logical PYTHON_TMP* /process

(LNM$PROCESS_TABLE)

  "PYTHON_TMP1" = "USER_HERE:[ZESSIN.PYTHON_TMP]"
  "PYTHON_TMP2" = "/user_here/zessin/python_tmp"
$
$ show logical SYS$SCRATCH
   "SYS$SCRATCH" = "USER_HERE:[ZESSIN]" (LNM$JOB_845CE780)
$
There can be a problem if SYS$SCRATCH points to a logical name search list. The 'pkg' test fails for some reason that I have not tried to find out - please redefine SYS$SCRATCH in such a situation.

test_rgbimg

is used for some regression tests.

The module was using a filename character ("@") that is invalid on ODS-2 and used filenames with multiple '.'s which does not work in ODS-2, too.

test_signal

is used for some regression tests.

This test is currently disabled, because signal handling usually works different on OpenVMS. @@ It might come back after some tests with a current DEC C RTL.

test_support

is used for some regression tests.

The module was using a filename character ("@") that is invalid on ODS-2.

user

is used to execute the script ".pythonrc.py" in the user's "home" directory on Unix systems when the command 'import user' is given.

This is an invalid file specification for an ODS-2 formatted disk; the default OpenVMS file system.

On OpenVMS systems the script executes the file 'PYTHONRC.PY' from the user's login directory. It does not use "SYS$LOGIN" - instead it uses the C RTL's "HOME" environment variable. See the script for details.


(go to: table of contents, index, prev: embedding the Python interpreter, next: changes to Python source)

09-AUG-2000 ZE.