In Modern IDL, I give a short demo of using pyIDL to use IDL from within a Python session. I have had problems with installing pyIDL lately, but didn’t have an alternative until I found pIDLy recently. It easy_installs nicely and has an even nicer interface:

>>> import pidly
>>> idl = pidly.IDL()
>>> idl('x = total([1, 1], /int)')
>>> print idl.ev('x')
2
>>> print idl.ev('x ^ 2')
4
>>> idl.reform(range(4), 2, 2)
array([[0, 1],
       [2, 3]])
>>> idl.histogram(range(4), binsize=3, L64=True)
array([3, 1], dtype=int64)
>>> idl.pro('plot', range(10), range(10), xstyle=True, ystyle=True)
>>> idl.interact()
IDL> print, x
                  4
IDL> exit
>>> idl.close()

I don’t see any versioned releases since 2008, but there are commits to the GitHub repo in the last few months so I believe the project is still alive. In any case, it does what I need right now and I can install it. Updating book to use pIDLy…