0

I am trying to use IDL-Python bridge to call IDL (Interactive Data Language) procedures from Python. Could anybody tell how to access IDL system variables that starts with '!' from Python? For example, a call in Python

from idlpy import *

d2r = IDL.!DDTOR 

gives SyntaxError: invalid syntax.

jww
  • 97,681
  • 90
  • 411
  • 885
  • Presumably there is something more this can be tagged with because I have no idea what this question is about solely in the context of Python – roganjosh Oct 17 '18 at 17:54
  • Sorry, this is my first question on Stack Overflow. I couldn't fine a tag to IDL(Interactive Data Language). The information about IDL-Python bridge is here: https://www.harrisgeospatial.com/docs/Python.html – Irina Tkatcheva Oct 17 '18 at 18:08
  • Where specifically should we be looking for `.!` syntax? I can't say it's wrong but, if there's no tag for what you're using, you need to add some more context I think :) – roganjosh Oct 17 '18 at 18:17
  • I think I found a correct tag: idl-programming-language. Thank you for your help! – Irina Tkatcheva Oct 17 '18 at 18:26

1 Answers1

1

I found the solution at https://www.harrisgeospatial.com/docs/PythonToIDL.html#SystemVariables:

To retrieve an IDL system variable such as !DPI or !CONST, you can use the Python getattr() method:

>>> from idlpy import *
>>> getattr(IDL, "!dpi")
3.1415926535897931
Community
  • 1
  • 1