<PROTECT> *Function not allowed in IRIS Native python
Hello Community,
I got the PROTECT error while running functions. But, I could able to call the classmethods and methods in class definition with classMethodObject, classMethodValue etc.. from python. without any errors
python code
irispy.functionString('fnString','IRISPython',14)
irispy.function('fnString','IRISPython',14)raise RuntimeError(error_message) RuntimeError: <PROTECT> *Function not allowed
IRISPython.mac
fnString(fn1) public {
quit"Hello "_fn1
}
Comments
See Run an ObjectScript Routine from Embedded Python2024.1
Example:
USER><FONT COLOR="#0000ff">d $system</FONT><FONT COLOR="#008080">.Python</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Shell</FONT><FONT COLOR="#000000">()</FONT>iris.routine("fnString^IRISPython",14) 'Hello 14'
Hello @Vitaliy Serdtsev,
I executed the routine invocation commands in native python script.
Starting from 2024.1 IRIS Native disallows routine invocations. Please use class methods instead.
For reference, these changes can be identified as DP-422635 and DP-424156.
Thank you @Eduard.Lebedyuk. Could you please paste the link of DP-422635 and DP-424156.that would be helpful.
I join the question @Ashok.Kumar.
I did not find DP-422635 and DP-424156 among the published ones:
- InterSystems IRIS® Change Notes (2024.1.3)
- InterSystems IRIS® Upgrade Checklist (2024.2)
- InterSystems IRIS® Upgrade Checklist (2024.3)
- InterSystems IRIS® Upgrade Checklist (2025.1)
In addition, there are no warnings in the documentation that these methods are deprecated and no longer work: Calling Functions and Procedures from Python
And what was the reason for it?
Routnes now deprecated in IRIS?
I believe what you're looking at is the new, more fine-grained set of %Native_* resources you need to use native functions. Look for DP-423341 in the upgrade guide. It seems we failed to describe this requirement in the Native API documentation (or at least I didn't find it where I expected it), so we'll get that addressed.
I'd also recommend defaulting to the new, dynamic upgrade guide that makes it easier to filter on particular types of issues. This is now replacing the old, static pages that were more reliant on / vulnerable to manual curation. In fact you'll no longer find those static pages from the menu in the 2025.1 doc.