· Nov 29, 2019

How to execut code in local .py file in python gateway?

who has tried "python gateway" in OpenExchange, could you please tell me how to  execute code in a local .py file? a cusotmer engineer ask me the question while I don't have time to study it yet. Thank you very much. 

Discussion (3)2
Log in or sign up to continue

In addition to Eduard's answer, a short example based on sending Python's exec command to Python (assuming Python 3.*) to execute a Python script stored in a file:

(1)  Create a in some folder that Python has access to, add the following lines to

print('Hello Python Gateway',file=f)

Save and close

(2)  Open  IRIS Terminal, type and execute one by one the following commands:

set sc=##class(

set sc=##class("exec(open('disk:/path/to/your/folder/').read())",,,.sc)

(3) Check the output.txt file that has been created in your folder