Article
· Jul 24 1m read

Running Python in the InterSystems IRIS Terminal

Are you curious about how to run Python scripts directly in your InterSystems IRIS or Caché terminal? 🤔 Good news it's easy! 😆 IRIS supports Embedded Python, allowing you to use Python interactively within its terminal environment. 

How to access the Python Shell?

To launch the Python shell from the IRIS terminal, simply run the following command:

do ##class(%SYS.Python).Shell()

This opens an interactive Python shell inside the IRIS terminal. From here, you can write and run Python code just as you would in a normal Python environment.

Exiting the Shell:

>>> quit()

This will exit the Python shell and return you to the ObjectScript prompt.

 

USER>do ##class(%SYS.Python).Shell()
 
Python 3.9.5 (default, May 31 2022, 12:35:47) [MSC v.1927 64 bit (AMD64)] on win32
Type quit() or Ctrl-D to exit this shell.
>>> name = 'Vachan'
>>> age = 25
>>> print('Name: ',name,'\nAge:',age)
Name:  Vachan
Age: 25
>>> quit()

 

This is a great way to leverage Python's capabilities within your InterSystems environment. Whether you're experimenting, testing logic, or integrating with ObjectScript, the embedded Python shell makes it fast and flexible.

Enjoy Coding! 👨‍💻

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