54

Error in Python to IDL bridge: idlpy.IDLError: % Attempt to call undefined function

 

The following Help Article proposes a solution to the below error message when running the Python to IDL bridge

idlpy.IDLError: % Attempt to call undefined function: '<function name>'.

 

Problem description:

The sequence of steps below when running the Python to IDL bridge may result in an error - the below example is for Linux ; a similar behavior may be observed on Windows too:

 

support@support-VirtualBox:$ python

Python 3.8.10 (default, Jun  2 2021, 10:49:15)

[GCC 9.4.0] on linux

Type "help", "copyright", "credits" or "license" for more information.

>>> from idlpy import *

IDL 8.8.1 (linux x86_64 m64).

(c) 2021, Harris Geospatial Solutions, Inc.

Licensed for use by: xxxxx

License: 1234

>>> arr = IDL.findgen(100)/50*3.14159

>>> x = 50*IDL.sin(arr)

>>> y = 50*IDL.cos(arr)

>>> m = IDL.map(test=1)

% Attempt to call undefined function: 'MAP'.

% Execution halted at: $MAIN$         

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/usr/local/harris/envi56/idl88/lib/bridges/idlpy.py", line 288, in __call__

    if err: raise IDLError(output)

idlpy.IDLError: % Attempt to call undefined function: 'MAP'.

 

This error is due to a wrong/missing definition of the IDL_DIR path when starting IDL from Python and it can prevent access to some IDL routines.

 

Solution:

This problem can be easily fixed by defining the IDL_DIR environment variable prior to starting Python.

On Windows this definition can be added in the System Variables by editing the Windows environement variables

On Linux this definition can also be added in the user’s shell resource file which is executed upon login to the Linux session (e.g. ~/.bashrc).

 

The output of the previous sequence of steps -on Linux-  will then be:

 

support@support-VirtualBox:$ export IDL_DIR=/usr/local/harris/envi56/idl88

support@support-VirtualBox:/usr/local/harris/envi56/idl88/lib/bridges$ python

Python 3.8.10 (default, Jun  2 2021, 10:49:15)

[GCC 9.4.0] on linux

Type "help", "copyright", "credits" or "license" for more information.

>>> from idlpy import *

IDL 8.8.1 (linux x86_64 m64).

(c) 2021, Harris Geospatial Solutions, Inc.

Licensed for use by: xxxx

License: 1234

>>> arr = IDL.findgen(100)/50*3.14159

>>> x = 50*IDL.sin(arr)

>>> y = 50*IDL.cos(arr)

>>> m = IDL.map(test=1)

% Loaded DLM: XML.

% Loaded DLM: PNG.

% Loaded DLM: LAPACK.

% Loaded DLM: SHAPEFILE.

 

Note that no error is returned and a world map is displayed.

 

 

__________________________

created by BC on 8/19/21 - reeviewed by BC(US)

Please login or register to post comments.