Question
· Mar 2

$ZF(-100) to run python script not work when directly execute in studio or in storedproc called by TrakCare, but can work when do in iris session

Hi all,

Does anybody have the same issue?

$ZF(-100) to run python script not work when directly execute in studio or in storedproc called by TrakCare, but can work when do in iris session.

The python script imports a "barcode" package. It seems that when directly execute in studio or in storedproc called by TrakCare, the package can not be imported.

s r = $ZF(-100,"/SHELL", "/usr/bin/python3.9","/trak/cnpubase/tc/webfiles/web/custom/CNPU/script/py/barcode/genslbarcodetest.py",keyStr,path)
import sys
import barcode
from barcode.writer import ImageWriter
spn=sys.argv[1]
name=sys.argv[2]
def testEan(str):
    EAN = barcode.get_barcode_class('code128')
    print(str)
    ean = EAN(u''+str, writer=ImageWriter())
    fullname = ean.save(name,options={"write_text": False})
if __name__ == '__main__':
    testEan(spn)
Product version: IRIS 2022.1
Discussion (2)2
Log in or sign up to continue

When you run $zf(-100) from IRIS session terminal the external process is run in the OS context (secutity/permissions) of the OS user loggen in.

When $zf(-100) is run by a storedproc or studio is run in the OS context (secutity/permissions) of the OS user used by the IRIS instance.

You have permission and/or environment issue.

Why run python using $zf(-100)? You can use embedded python to avoid this issues, it is simpler and have better performance.

Appreciated the answer, Enrico.

Your analysis really hit it. We uninstalled the python-barcode and pillow package from each of the os user: irisowner/irisusr/root. And only re installed them in root user. It works.

Regards the embedded python. Because the python script was wrote and run in a early IRIS version. So we re use the same way. I think it's good idea to use embedded python from IRIS2022.

Regards,

wanbo