Importance of Python

User avatar

Topic author
ajbrehm
Valued Contributor
Posts: 62
Joined: Sun Jun 16, 2019 7:55 am
Reputation: 6
Location: Zurich
Status: Offline
Contact:

Importance of Python

Post by ajbrehm » Sat Mar 28, 2020 1:58 pm

I think this forum chapter should get started.

While I am not very familiar with Python myself (I am from the PowerShell/C# camp) I am convinced that Python support will be crucial for OpenVMS adoption on x64-64.

Especially since MSFT gave up Nano Server as a stand-alone version of Windows, OpenVMS might well be adopted as an engine for Python programs more secure and more Windows-like (ACLs and privileges) than Linux. I talked to developers at work and Python is growing bigger and we have lots of VMs running Python programs, some Linux, some Windows, all much too big for the little Python program they are hosting.

Assuming OpenVMS licensing is not too complicated (i.e. like in the past!) and licenses for simple systems are not too expensive, I can see one future for OpenVMS as a Python OS in Windows environments.
Last edited by ajbrehm on Sat Mar 28, 2020 2:00 pm, edited 1 time in total.


andrew_shaw
Member
Posts: 5
Joined: Thu Jun 13, 2019 7:16 pm
Reputation: 0
Location: Melbourne, Australia
Status: Offline

Re: Importance of Python

Post by andrew_shaw » Fri Apr 17, 2020 3:27 am

I think this is a very valid point.

I've lived in the VMS world for many many years, but I am brand new to the Python world and I am very quickly seeing that it has a place. I have a pet project at the moment where I am writing some Python routines as wrappers for some really handy VMS stuff like TRNLNM so they can be called cleanly from other Python programs and have the VMS OS specific stuff hidden away so that you don't need an engineering degree in VMS in order to make use of its power. In the current dev world I live in where all the devs have simply "learned to exist" with VMS rather than actively embracing it, it will be very handy for them - plus is fun work for me :-)

So I really can see a future for Python in the VMS world.

Bring on Python 3 ;-)
VMS Evangelist (to those who will listen) :D

User avatar

martinv
Master
Posts: 101
Joined: Fri Jun 14, 2019 11:05 pm
Reputation: 0
Location: Goslar, Germany
Status: Offline
Contact:

Re: Importance of Python

Post by martinv » Fri Apr 17, 2020 4:30 am

andrew_shaw wrote:
Fri Apr 17, 2020 3:27 am
I have a pet project at the moment where I am writing some Python routines as wrappers for some really handy VMS stuff like TRNLNM so they can be called cleanly from other Python programs
You mean like vms.rtl.lib.get_logical? ;)
Working hard for something we don't care about is called stress;
working hard for something we love is called passion.
(Simon Sinek)


andrew_shaw
Member
Posts: 5
Joined: Thu Jun 13, 2019 7:16 pm
Reputation: 0
Location: Melbourne, Australia
Status: Offline

Re: Importance of Python

Post by andrew_shaw » Fri Apr 17, 2020 5:01 am

martinv wrote:
Fri Apr 17, 2020 4:30 am
You mean like vms.rtl.lib.get_logical? ;)
Yes, like that, which I knew about, but that only did half the job.
I also needed to get to the TRANS=TERMINAL attribute though, which is why I had to go to SYS$TRNLNM()
VMS Evangelist (to those who will listen) :D


brett.cameron
VSI Expert
Active Contributor
Posts: 25
Joined: Mon Jun 24, 2019 9:51 am
Reputation: 0
Status: Offline

Re: Importance of Python

Post by brett.cameron » Fri Apr 17, 2020 5:08 am

andrew_shaw wrote:
Fri Apr 17, 2020 5:01 am
martinv wrote:
Fri Apr 17, 2020 4:30 am
You mean like vms.rtl.lib.get_logical? ;)
Yes, like that, which I knew about, but that only did half the job.
I also needed to get to the TRANS=TERMINAL attribute though, which is why I had to go to SYS$TRNLNM()
We do actually have that in the 3.5 kit but it's not documented :( We'll see about addressing this and maybe look to provide a set of hopefully useful examples.. We'll also see about adding knowledge of these functions into the IDE.


andrew_shaw
Member
Posts: 5
Joined: Thu Jun 13, 2019 7:16 pm
Reputation: 0
Location: Melbourne, Australia
Status: Offline

Re: Importance of Python

Post by andrew_shaw » Fri Apr 17, 2020 5:14 am

brett.cameron wrote:
Fri Apr 17, 2020 5:08 am
andrew_shaw wrote:
Fri Apr 17, 2020 5:01 am
martinv wrote:
Fri Apr 17, 2020 4:30 am
You mean like vms.rtl.lib.get_logical? ;)
Yes, like that, which I knew about, but that only did half the job.
I also needed to get to the TRANS=TERMINAL attribute though, which is why I had to go to SYS$TRNLNM()
We do actually have that in the 3.5 kit but it's not documented :( We'll see about addressing this and maybe look to provide a set of hopefully useful examples.. We'll also see about adding knowledge of these functions into the IDE.
Great, that would be really cool and no doubt easier than what I have at the moment, but what I have now works (its not very pretty, but that's why I'm trying to hide it). If you have a nicer version coming then so much the better :-)
VMS Evangelist (to those who will listen) :D


willemgrooters
Valued Contributor
Posts: 87
Joined: Fri Jul 12, 2019 1:59 pm
Reputation: 0
Location: Netherlands
Status: Offline
Contact:

Re: Importance of Python

Post by willemgrooters » Sun Apr 19, 2020 10:55 am

Actually, there is a port of Python on OpenVMS, a (very) old one but it seems to be rather complete. Info on http://www.vmspython.org/doku.php.

Easy install since all you need are two logical disks, located on http://downloads.vmspython.org/anonymou ... images_ld/: jfplib0008A.zip and jfppy0700a_278.zip. Extract the disk containers (*.dsk), use LD to connect and mount them and add startup to SYSTARTUP.COM and your login script - consult documentation.

For what I know, there have been made a start to port Python 3.x to VMS but is has been blocked - what I'm told is that the fact that VMS doesn't implement fork as in Unix, and there are well accepted methods to bypass that, the team on python is not willing to adhere to these methods - that is my understanding. Furthermore, in the early days of development of this new version, all VMS-related code has been removed - because there was no maintainer (according to the team).
This was a few months ago - thing may have changed .

But VSI is well aware of the importance of supporting Python 3 - but they have other priorities at the moment :)

User avatar

arne_v
Master
Posts: 299
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: Importance of Python

Post by arne_v » Mon Apr 20, 2020 8:28 pm

I believe VSI's Python 3.x kit went into field test in February.
Arne
arne@vajhoej.dk
VMS user since 1986


garyrevell
Active Contributor
Posts: 38
Joined: Thu Nov 19, 2020 7:15 am
Reputation: 0
Location: Basingstoke, UK
Status: Offline
Contact:

Re: Importance of Python

Post by garyrevell » Thu Jul 29, 2021 11:28 am

I'm a big fan of Python and will try out the new VSI kit when time permits.

It's excellent for general purpose file type programming as well , of course, of some of its more esoteric uses ! :)

User avatar

neilrieck
Contributor
Posts: 19
Joined: Tue Jan 10, 2023 10:41 am
Reputation: 0
Location: Waterloo, Ontario, Canada
Status: Offline
Contact:

Re: Importance of Python

Post by neilrieck » Wed Jul 19, 2023 6:27 am

martinv wrote:
Fri Apr 17, 2020 4:30 am
andrew_shaw wrote:
Fri Apr 17, 2020 3:27 am
I have a pet project at the moment where I am writing some Python routines as wrappers for some really handy VMS stuff like TRNLNM so they can be called cleanly from other Python programs
You mean like vms.rtl.lib.get_logical? ;)
I was thrown to the wolves last week so cobbled together this little demo to translate logical names (it is a quick hack so beware the sharp edges)

Code: Select all

'''
===========================================================
title   : logical_name_demo_100.py
url     : https://neilrieck.net/
platform: python-3.10.0 on VSI OpenVMS Version 8.4-1H1 I64
author  : Neil Rieck
created : 2023-07-13
edit    : 2023-07-14
notes   :
1) demos how to read OpenVMS logical names
2) also shows how to reference STARLET definitions
3) this was a quick hack employing a few shortcuts
usage  :
    python logical_name_demo_100.py
===========================================================
'''
from vms import dscdef as DSC       # dscdef is from STARLET
from vms import lnmdef as LNM       # lnmdef is from STARLET
from vms import ssdef as SS         # ssdef  is from STARLET
from vms import ile3 as ILE3        # item list definitions
from vms import sys as SYS          # system calls via python wrapper
import _sys as VMS                  # native system calls (natural parameter order)
from vms.sys import trnlnm          # this is a third way
from vms.lib import get_hostname    # something else

# =========================================================

def breakout(title, obj):
    print(title)
    for x in obj:
        print("x: ", x)

def main():
    hn = get_hostname()
    print("hostname: ", hn[1])
    print("debug? (0/1, default=0) ", end="")
    try:
        debug = input()
        if type(debug) != int:
            debug = int(debug)
    except Exception:
        debug = 0
    log_table = "LNM$SYSTEM_TABLE"
    log_name = "SYS$DISK"
    log_value = ""
    print(f"TEST> table: {log_table} logical name: {log_name}")
    #
    for test in range(1, 3):
        print(40*"=", f" test #{test}")
        itmlst = ILE3.ile3list()
        itmlst.append(LNM.LNM__STRING, DSC.DSC_K_DTYPE_T, 255)          # should use 255 here
        if 1 == 0:                                                      # enable for 4 more items
            itmlst.append(LNM.LNM__LENGTH, DSC.DSC_K_DTYPE_LU)          # bytes returned
            itmlst.append(LNM.LNM__INDEX, DSC.DSC_K_DTYPE_LU)           # index
            itmlst.append(LNM.LNM__ATTRIBUTES, DSC.DSC_K_DTYPE_LU)      # created attributes
            itmlst.append(LNM.LNM__TABLE, DSC.DSC_K_DTYPE_T, 32)        # table name
        if debug > 0:
            breakout("itmlist before the call", itmlst)
        if test == 1:
            rc = SYS.trnlnm(None, log_table, log_name, None, itmlst)    # STARLET parameter order
        else:
            # 
            # https://wiki.vmssoftware.com/VMS-Specific_Python_Modules
            # trnlnm(attr:int, tabnam:str, lognam:str, acmode:int, il:object)->int
            #        
            rc = VMS.trnlnm(log_name, log_table, itmlst)                # wrapper parameter order 
        print("rc  :", rc)
        if debug > 0:
            breakout("itmlist after the call", itmlst)
        if rc == SS.SS__NORMAL:
            print("-i-the call to trnlnm was successful")
            log_value = itmlst[0]
            print("log_value: ", log_value)
        else:
            print("-w-the call to trnlnm failed")
    # --------------------------------------------

if __name__ == "__main__":
        main()

# this is the end
Added in 31 minutes 42 seconds:
Every person has their favorite languages but Python might be the most important language in computing this side of y2k, and is almost always the starting point for work in ML (machine learning). But here is a practical example: In 2012 I toyed with writing a "Diffie-Hellman Key Exchange" demo but then ran into library limitations of the AlphaServer I was on at the time (this is the point were most people would go off to write their own routines to support math larger than the maximum native size). Four years later I was learning python3 so went back to that demo and coded it with little difficulty.

Code: Select all

1) In BASIC, this statement "PRINT int(2^31)" fails with 32-bit signed integers (longword)
   (written for clarity; you should append % to each number)
2) In BASIC, this statement "PRINT int(2^63)" fails with 64-bit signed integers (quadword)
3) In Python, this statement "PRINT(2**9999)" instantly yields 37x80+50 characters.
   (now repeat by adding more nines)
 
Last edited by neilrieck on Sun Jul 23, 2023 8:44 am, edited 1 time in total.

Post Reply