· Sep 19, 2022

Python method; issues with status returned from run_class_method

In my Python script I import intersys2.pythonbind3 to create the connection and define a database object as db

I execute the method 

     res = self.db.run_class_method("%Library.GlobalEdit", "GetGlobalSize",[<db>, allocated,used])

This executes correctly as I loop through a list of databases.

Upon success I see that the return arg of "res" contains the string "status(0,)" which I interpret as successful. This is verified by the returned values of allocated and used being accurate. But I want to use the class/methods to get the status values from the returned structure

In reading the documents, I thought the statement:

    status = self.db.run_class_method('%SYSTEM.Status', 'IsError', [res])

would return a value of 1 on error, but this statement always returns 1;  even when res='status(0,)' which is indicative of success.

Any ideas about what I am missing or doing incorrectly?

Product version: Caché 2017.1
Discussion (5)1
Log in or sign up to continue

Ok, trying to isolate my syntax error. I have re-reviewed the class specs but I am not seeing an issue. I have this:

    allocated = 0
    used      = 0
    db          = "/data/testdb/"
    global      = "STRELPERF"
    # Set args to pass by reference
    list = [db,global,allocated,used]

    # exec the class method to get the global size
    res = self.db.run_class_method("%Library.GlobalEdit", "GetGlobalSize",list)

This is the call that returns the failure status of res(0,). The associated error text is :

ERROR #00: (no error description)

Since for other databases that do not contain the global I get the error:

ERROR #308: Global STRELPERF not found.

It seems that code clip is close but something that I am not seeing is missing. Any help would be appreciated.