Python is a straightforward and efficient scripting language. I have known that we could use python in IDIRIS, but I can't approach the concrete procedures for how to execute python in IDRISI? Shall we import python coding into IDRISI or just execute the python scripting independently outside of IDRISI? Furthermore, is IDRISI compatible with other scripting language?
3 comments
-
Clark Labs Tech Support Team To use Python scripting with IDRISI, you will need to first import the COM client and call the IDRISI COM server. You will need to include the following two lines at the top of your Python script:
import win32com.client
IDRISI32 = win32com.client.Dispatch('IDRISI32.IdrisiAPIServer').
Then, to call an IDRISI module you will need to follow this format:
IDRISI32.RunModule('module name', ‘module parameters’, 1, '','','','',1)
For example:
IDRISI32.RunModule('OVERLAY', '2*input1.rst*input2.rst*output.rst', 1, '','','','',1)
The ‘ 1, '','','','',1 ‘ at the end of the line must be included with every operation. The parameters for each module can be found in the ‘macro command’ link in the help of each module.
To run a Python script that calls IDRISI modules, IDRISI must be running on your computer. The Python script should be run through your Python interpreter, such as Python IDLE or PythonWin.
-
manoj Is there any python version dependency if so, which version go well with Idrisi Selva.
-
Zhen Yuan I tried Python 2.7 and it works well.