Hi,

I am using embeded python to utilize some pythonic library but i got a problem on my hand.

One of the python function i am using return multiple values

in python you would do something like that :

val1, val2, val3, = function(params)

In COS I got something like that :

lib = ##class(%SYS.Python).Import("lib")
val1 = lib.function(params)

And I don't know how to get the second and third values.
Is there a way to get them?

1 5
0 73

I'm currently facing an issue with a Python script in my IRISHealth environment and would appreciate your insights.

I've written a class method, `getTokenCount`, in Python, which uses the `tiktoken` module. However, when I run the script in the terminal using `do ##class(python.openaiUtils).getTokenCount("")`, I encounter the following error:

0 3
0 192
Question
· Oct 15, 2023
MIRROR for Embedded Python ?

MIRROR is the best solution for almost immediate replications to a Failover Server.
The related mechanics are based on Global Journaling.

Globals hold Data and Classes and Routines and more ...
If Mirroring is in place all is in sync. With minimum delays
This is of course rather useful for code changes in Classes, Routines, ....

To what extent is Embedded Python covered by Mirroring?
Or:
What is required to Synchronize EmbeddedPython like Mirroring.

1 2
0 132
Question
· Oct 15, 2023
embedded Python over ECP

With ECP we have the option to have a collection of Frontend instances
All Frontend servers typically have a common Master in the background
Concentrating data on the Master server is the primary goal.

As a side effect, this applies also to Classes, Routines, .. anything stored in Globals.
This is probably not the most efficient setup. But rather common anyhow.

Is embedded Python code also stored in Globals?

What is the recommended solution for a similar installation?

1 2
0 120

Hi everyone,

I'm attempting to compile a basic Python code on a remote server, but it appears that the compiler doesn't recognize the language.

The remote server is running a virtual machine with Oracle Linux Server 7.9 (64-bit), and it has IRIS for UNIX (Red Hat Enterprise Linux for x86-64) 2021.1 (Build 215U) [HealthConnect:3.3.0] installed.

When I try to compile a script that includes a Python ClassMethod, such as this "testpy.cls":

0 4
0 150

Hi all,
I am trying to execute a query like the below code.
set statement = ##class(%ResultSet).%New("some_class:query_method"). // here query method is empty and with rowspec some columname

statement.Execute(param1)

I want to fetch data type of column value returned from above. eg - Name - VARCHAR, amount - INTEGER etc.
How can I get it. Or if not possible directly. Is there any other way to validate or get datatype of values returned. Line we have type() in python3

0 5
0 308

For my Embedded Python ONLY demo package I need some user input.
Similar to ObjectScript

read "say somthing",reply

I use the Python equivalent

reply = input("say something")

And this works excellent without problems from Terminal or Doker console

BAD SURPRISE:
with WebTermnial ObjectSscript works fine, but embedded Python fails badly.

1 7
0 230

Hi All,

We're doing our first babysteps with embedded Python and IRIS with an interoperability solution. We want to convert a CSV file to an Excel xlt file.

As service we've got a EnsLib.File.PassthroughService which picks up a csv file

As operation we've got a EnsLib.File.PassthroughOperation which writes the Excel file.

In the middle:

We've created an Business Process with an %Stream.GlobalCharacter in the Request and a %Stream.GlobalCharacter in the Response.

0 3
0 266
Question
· Jul 28, 2023
IRISPIP Cryptodome C++ Error

Hello,

I need AES ECB with PKSC7 padding for an interface.
Unfortunately, the %SYSTEM.Encryption.AESEncode cannot do this.

Therefore I wanted to include the following python lib.
PyCrptydome -> https://pycryptodome.readthedocs.io/en/latest/index.html

We need to install the package offline on the system. So I downloaded it and put it in the MGR/Python/ directory.

However, when I try to install it, I get the following error message:

0 11
0 209

Hi folks!

How can I refer to a classmethod of the same class while coding another classmethod with Embedded python?

I know that I can call it with iris.cls(classname).MethodName(), but it's more cumbersome even comparing with ObjectScript, where I can call ..MethodName().

Compare ObjectScript:

do ..SetupGame()

and the same call in EmbeddedPython:

    iris.cls('eshvarov.sample.SeaBattle.GamePython').SetupGame()

Thoughts?

0 6
0 249

Has anyone come across a good using Embedded Python to convert a Python List object to an IRIS %List object?

My use case is I want to open an SQL entry with an Objectscript class method, then pass some information from that row into a separate Python class method which will then create a Python List object, then have the Python class method return that list back to the Objectscript class method in such a way that the Python List can be converted to an IRIS %List object for me to then use in the Objectscript code.

0 3
0 204

So, I know that I can return a SQL Error message from my SQL Procedure written in ObjectScript, with code like this

$ cat <<EOF | irissqlcli iris://_SYSTEM:SYS@localhost:1972/USER
CREATE or REPLACE PROCEDURE test()
LANGUAGE OBJECTSCRIPT
{
 SET %sqlcontext.%SQLCODE = 400
 SET %sqlcontext.%ROWCOUNT = -1
 SET %sqlcontext.%Message = "test error message"
};

CALL test();

EOF
[SQLCODE: <-400>:<Fatal error occurred>]
[Location: <SPFunction>]
[%msg: <test error message>]

But I did not find how to do it with Python. I can't find %sqlcontext variable available there

0 1
0 166

I copied a 5 MB messages.log file to AWS where I have iris-log-viewer app deployed. I ran the test to see how it takes in IRIS code to import the lines into a persistent table:

IRISAPP>set m5mb="/home/irisowner/irisdev/messages.old_20221231.log"

IRISAPP>

IRISAPP>do ##class(otw.log.irislogreader).Test1(m5mb)
Test1 begins at 02/05/2023 12:49:30
ReadLogLines
/home/irisowner/irisdev/messages.old_20221231.log
Open
Test1 ends at 02/05/2023 12:49:34
Test1 execution time: 3.500789

select count(*) from otw_log.Log

63239

0 7
0 198

Hi developers!

Those who code IRIS solutions in VSCode using Docker often use the convenient ObjectScript menu, which contains links to Management Portal, Class Reference, Unittest portal, Productions, etc.

While drilling down to a Dev Container to code Embedded Python there is no such option, at least within my settings:

So I don't know how to connect to it.

Thoughts?

0 6
0 247