Published on InterSystems Developer Community (https://community.intersystems.com)

Home > Python method; issues with status returned from run_class_method

Question
Kevin McGinn · 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?

#Python #Caché
Product version: Caché 2017.1

Source URL:https://community.intersystems.com/post/python-method-issues-status-returned-runclassmethod