Here, those scripts are embedded python script, which are different from python script.

For whatever reason, embedded python iris module is called iris and official driver is also called iris from this wheel intersystems_irispython-3.2.0-py3-none-any.whl.

This create confusion and package collision, an community edition exist that solve this issue and allow you to use them both, you can install it from here : https://github.com/intersystems-community/intersystems-irispython

Another option is to use the iris wrapper : https://pypi.org/project/iris-embedded-python-wrapper/

Works well on macos, and i'm looking for feedback on windows machines.

Hi,

My bet is that you are using web server port 52773 instead of 1972

Try this :

import iris

# Open a connection to the server
args = {'hostname':'127.0.0.1', 'port':1972,
    'namespace':'USER', 'username':'_SYSTEM', 'password':'SYS'
}

try:
    conn = iris.connect(**args)
    # Create an iris object
    irispy = iris.createIRIS(conn)
except Exception as e:
    # Handling the exception and printing the error
    print(f"An error occurred: {e}")

Thanks for this feedback, this is very helpful for our implementation of WSGI/ASGI. As you can see it's still a work in progress, but we are working hard to make it better.

We will have a look at the cookie issue, we encountered it as well, but we haven't gone deep into it yet as you did. Your feedback will help us, thanks again.

For the ASGI Post issue, it's also a known issue, that will be fixed in the next release.

We also plan to add more features to the WSGI/ASGI implementation, like the ability to reload the server with a button click/a command line.

We will have a look also at the WebSockets support.

Hi @ala zaalouni,

When you encounter this error :

The error appears: "An error has occurred: iris.cls: error finding class"

This usually mean that the Iop framework is not loaded into iris.

pip install iris-pex-embedded-python

you must init it to iris (install the associated classes to iris), for that you must do :

iop --init

or

from iop import Utils
Utils.setup()

please refer to the documentation :

https://github.com/grongierisc/interoperability-embedded-python?tab=read...

For the more, make sure you are on the right namespace by specifying the var env : $IRISNAMESPACE

Great application, do you know that iris now support wsgi app : https://docs.intersystems.com/iris20241/csp/docbook/Doc.View.cls?KEY=AWSGI

For the more, you did a pretty good job with a python only app, can you have a look at this one and tell me if you wish to learn more about Iop (Interoperability on python, the backend framework of this app): https://community.intersystems.com/post/vector-search-and-rag-retrieval-...

For this given python function :

file name demo.py

def return_tuple():
    return 1, 2, 3

To retrieve the values in ObjectScript, you can use the following code, basically use dunder methods to access the values.

set return = ##class(%SYS.Python).Import("demo")."return_tuple"()
write return."__len__"() // 3
write return."__getitem__"(0) // 1
write return."__getitem__"(1) // 2
write return."__getitem__"(2) // 3

Once again, can we wrote a wrapper class for JDBC driver, eg : com.intersystems.dc.jdbc.IRISJDBCDriver, and use it to connect to IRIS?

The wrapper can be a public repository, and published to maven central, so that it can be used by anyone.

Like that no conflict with the official driver, and we can use it in any project.

Downside is that the name is not the same, so we need to change the driver name in the code, but it's a small price to pay.

Hi,

As you are in Aync mode, it's a bit tricky to get the end time. In sync mode, you just have to wait for the answer to be back.

In this case I would use the session id from the message that is going out of the business service to the BO.

So in the BS, try something like this:

Method OnProcessInput(
    pDocIn As %RegisteredObject,
    Output pDocOut As %RegisteredObject) As %Status
{
    // here you need to pass the jobid from the %CSP.REST that is invoking the BS
    set tJobId = pDocIn.JobID
    // your code here
    set ^CallApi($CLASSNAME(),tJobId,"sessionid") = ..%SessionId
    set pDocOut = pDocIn
    quit $$$OK
}

Then in the BO, you can use the session id to get the information from the global.

Method MyAsyncMethod(
    pRequest As %RegisteredObject,
    Output pResponse As %RegisteredObject) As %Status
{
    set tSessionId = ..%SessionId
    // lookup for the good session id
    for {
        set tClassname = $ORDER(^CallApi(tClassname))
        quit:tClassname=""
        for {
            set tJobId = $ORDER(^CallApi(tClassname,tJobId))
            quit:tJobId=""
            if ^CallApi(tClassname,tJobId,"sessionid") = tSessionId {
                set ^CallApi(tClassname,tJobId,"End") = $HOROLOG
                quit
            }
        }
    }
    // your code here
    quit $$$OK
}

I hope this helps.