comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDL-Python Bridge: problem with the ENVI function.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
IDL-Python Bridge: problem with the ENVI function. [message #92916] Wed, 23 March 2016 04:46 Go to next message
loreberna is currently offline  loreberna
Messages: 2
Registered: March 2016
Junior Member
Hi all,
my aim is to use a script written in IDL, into python:

IDL code:

PRO PS_GS
; Start the application
e = ENVI()
;Generate the roi from a vector file
; Open a vector file
file_vec = Filepath('Sic_Trapani.shp', ROOT_DIR = 'E:\mydirectory\')
vettore = e.OpenVector(file_vec)
; Get the task from the catalog of ENVITasks
Task_VtoR = ENVITask('VectorRecordsToROI')
; Define inputs
Task_VtoR.INPUT_VECTOR = vettore
; Define outputs
Task_VtoR.OUTPUT_ROI_URI = Filepath('roi_roi.xml', ROOT_DIR = 'E:\mydirectory\')
;Run the task
Task_VtoR.Execute
END

The above code, launched into IDL command prompt, works correctly.
I want make a python script that:

- option 1) launch the above idl .pro script
- option 2) use the IDL to Python Bridge sintax.

In the first case, using the `subprocess.call("idldirectory\idl.exe")` command, i can open the IDL prompt into the windows command prompt. But i can not execute any IDL function like a simple `PRINT, 'hello'`.

In the second case, i write the following poython code:

import subprocess
from subprocess import call
import idlpy
from idlpy import IDL
e=IDL.ENVI()
msi_file = """IDL.Filepath(mydata.tif", ROOT_DIR = 'mydirectory')"""
msi_raster = IDL.OpenRaster(msi_file)

The instruction `e=IDL.ENVI()` work correctly, in fact an Envi setion starts.

The instruction `msi_file = """IDL.Filepath(mydata.tif", ROOT_DIR = 'mydirectory')"""` work correctly.

My problem is with the OpenRaster instruction. It is an ENVI instruction and not an IDL instruction. So, IDL.OpenRaster does not work, and i do not have any solutions.

I have modified the code like:
msi_raster=IDL.ENVI().OpenRaster(msi_file)
The result is the following error message:
Impossible find the access point
??0LTISceneBuffer@LizardTech@@QEAA@AEBVLTIPixel@1@IIPEAPEAX@ Z
into the dynamic link library lti_DSDK.dll

Googling i have found this site:
Malware scan of gdal110.dll
Any help or suggestion? Thanks
Re: IDL-Python Bridge: problem with the ENVI function. [message #92917 is a reply to message #92916] Wed, 23 March 2016 07:24 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
Hi,
regarding Option 1:

Try compiling your file:
resolve_routine, 'PS_GS', /compile_full_file, /either
resolve_all
save, /routines, 'yourDirectory\ps_gs.sav'

Then try calling

subprocess.call("idldirectory\idlrt.exe yourDirectory\ps_gs.sav")

This works on my pc. I don't have Envi to test it though... I made a simple file with just
p = plot(/test)
inside and it works.

I didn't test the call from python, but it works from the command line.

Cheers,
Helder


On Wednesday, March 23, 2016 at 11:46:29 AM UTC, lore...@gmail.com wrote:
> Hi all,
> my aim is to use a script written in IDL, into python:
>
> IDL code:
>
> PRO PS_GS
> ; Start the application
> e = ENVI()
> ;Generate the roi from a vector file
> ; Open a vector file
> file_vec = Filepath('Sic_Trapani.shp', ROOT_DIR = 'E:\mydirectory\')
> vettore = e.OpenVector(file_vec)
> ; Get the task from the catalog of ENVITasks
> Task_VtoR = ENVITask('VectorRecordsToROI')
> ; Define inputs
> Task_VtoR.INPUT_VECTOR = vettore
> ; Define outputs
> Task_VtoR.OUTPUT_ROI_URI = Filepath('roi_roi.xml', ROOT_DIR = 'E:\mydirectory\')
> ;Run the task
> Task_VtoR.Execute
> END
>
> The above code, launched into IDL command prompt, works correctly.
> I want make a python script that:
>
> - option 1) launch the above idl .pro script
> - option 2) use the IDL to Python Bridge sintax.
>
> In the first case, using the `subprocess.call("idldirectory\idl.exe")` command, i can open the IDL prompt into the windows command prompt. But i can not execute any IDL function like a simple `PRINT, 'hello'`.
>
> In the second case, i write the following poython code:
>
> import subprocess
> from subprocess import call
> import idlpy
> from idlpy import IDL
> e=IDL.ENVI()
> msi_file = """IDL.Filepath(mydata.tif", ROOT_DIR = 'mydirectory')"""
> msi_raster = IDL.OpenRaster(msi_file)
>
> The instruction `e=IDL.ENVI()` work correctly, in fact an Envi setion starts.
>
> The instruction `msi_file = """IDL.Filepath(mydata.tif", ROOT_DIR = 'mydirectory')"""` work correctly.
>
> My problem is with the OpenRaster instruction. It is an ENVI instruction and not an IDL instruction. So, IDL.OpenRaster does not work, and i do not have any solutions.
>
> I have modified the code like:
> msi_raster=IDL.ENVI().OpenRaster(msi_file)
> The result is the following error message:
> Impossible find the access point
> ??0LTISceneBuffer@LizardTech@@QEAA@AEBVLTIPixel@1@IIPEAPEAX@ Z
> into the dynamic link library lti_DSDK.dll
>
> Googling i have found this site:
> Malware scan of gdal110.dll
> Any help or suggestion? Thanks
Re: IDL-Python Bridge: problem with the ENVI function. [message #92918 is a reply to message #92916] Wed, 23 March 2016 07:37 Go to previous messageGo to next message
Jim  Pendleton is currently offline  Jim Pendleton
Messages: 165
Registered: November 2011
Senior Member
On Wednesday, March 23, 2016 at 5:46:29 AM UTC-6, lore...@gmail.com wrote:
> Hi all,
> my aim is to use a script written in IDL, into python:
>
> IDL code:
>
> PRO PS_GS
> ; Start the application
> e = ENVI()
> ;Generate the roi from a vector file
> ; Open a vector file
> file_vec = Filepath('Sic_Trapani.shp', ROOT_DIR = 'E:\mydirectory\')
> vettore = e.OpenVector(file_vec)
> ; Get the task from the catalog of ENVITasks
> Task_VtoR = ENVITask('VectorRecordsToROI')
> ; Define inputs
> Task_VtoR.INPUT_VECTOR = vettore
> ; Define outputs
> Task_VtoR.OUTPUT_ROI_URI = Filepath('roi_roi.xml', ROOT_DIR = 'E:\mydirectory\')
> ;Run the task
> Task_VtoR.Execute
> END
>
> The above code, launched into IDL command prompt, works correctly.
> I want make a python script that:
>
> - option 1) launch the above idl .pro script
> - option 2) use the IDL to Python Bridge sintax.
>
> In the first case, using the `subprocess.call("idldirectory\idl.exe")` command, i can open the IDL prompt into the windows command prompt. But i can not execute any IDL function like a simple `PRINT, 'hello'`.
>
> In the second case, i write the following poython code:
>
> import subprocess
> from subprocess import call
> import idlpy
> from idlpy import IDL
> e=IDL.ENVI()
> msi_file = """IDL.Filepath(mydata.tif", ROOT_DIR = 'mydirectory')"""
> msi_raster = IDL.OpenRaster(msi_file)
>
> The instruction `e=IDL.ENVI()` work correctly, in fact an Envi setion starts.
>
> The instruction `msi_file = """IDL.Filepath(mydata.tif", ROOT_DIR = 'mydirectory')"""` work correctly.
>
> My problem is with the OpenRaster instruction. It is an ENVI instruction and not an IDL instruction. So, IDL.OpenRaster does not work, and i do not have any solutions.
>
> I have modified the code like:
> msi_raster=IDL.ENVI().OpenRaster(msi_file)
> The result is the following error message:
> Impossible find the access point
> ??0LTISceneBuffer@LizardTech@@QEAA@AEBVLTIPixel@1@IIPEAPEAX@ Z
> into the dynamic link library lti_DSDK.dll
>
> Googling i have found this site:
> Malware scan of gdal110.dll
> Any help or suggestion? Thanks

You have a reference to the ENVI object in your variable "e". Use this syntax instead:

msi_raster = e.OpenRaster(msi_file)

Jim P
Re: IDL-Python Bridge: problem with the ENVI function. [message #92919 is a reply to message #92918] Wed, 23 March 2016 08:57 Go to previous messageGo to next message
loreberna is currently offline  loreberna
Messages: 2
Registered: March 2016
Junior Member
For Jim P.
The sintax msi_raster=e.OpenRaster(msi_file) generate the same lti_dsdk.dll error.

On Wednesday, March 23, 2016 at 3:37:48 PM UTC+1, Jim P wrote:
> On Wednesday, March 23, 2016 at 5:46:29 AM UTC-6, lore...@gmail.com wrote:
>> Hi all,
>> my aim is to use a script written in IDL, into python:
>>
>> IDL code:
>>
>> PRO PS_GS
>> ; Start the application
>> e = ENVI()
>> ;Generate the roi from a vector file
>> ; Open a vector file
>> file_vec = Filepath('Sic_Trapani.shp', ROOT_DIR = 'E:\mydirectory\')
>> vettore = e.OpenVector(file_vec)
>> ; Get the task from the catalog of ENVITasks
>> Task_VtoR = ENVITask('VectorRecordsToROI')
>> ; Define inputs
>> Task_VtoR.INPUT_VECTOR = vettore
>> ; Define outputs
>> Task_VtoR.OUTPUT_ROI_URI = Filepath('roi_roi.xml', ROOT_DIR = 'E:\mydirectory\')
>> ;Run the task
>> Task_VtoR.Execute
>> END
>>
>> The above code, launched into IDL command prompt, works correctly.
>> I want make a python script that:
>>
>> - option 1) launch the above idl .pro script
>> - option 2) use the IDL to Python Bridge sintax.
>>
>> In the first case, using the `subprocess.call("idldirectory\idl.exe")` command, i can open the IDL prompt into the windows command prompt. But i can not execute any IDL function like a simple `PRINT, 'hello'`.
>>
>> In the second case, i write the following poython code:
>>
>> import subprocess
>> from subprocess import call
>> import idlpy
>> from idlpy import IDL
>> e=IDL.ENVI()
>> msi_file = """IDL.Filepath(mydata.tif", ROOT_DIR = 'mydirectory')"""
>> msi_raster = IDL.OpenRaster(msi_file)
>>
>> The instruction `e=IDL.ENVI()` work correctly, in fact an Envi setion starts.
>>
>> The instruction `msi_file = """IDL.Filepath(mydata.tif", ROOT_DIR = 'mydirectory')"""` work correctly.
>>
>> My problem is with the OpenRaster instruction. It is an ENVI instruction and not an IDL instruction. So, IDL.OpenRaster does not work, and i do not have any solutions.
>>
>> I have modified the code like:
>> msi_raster=IDL.ENVI().OpenRaster(msi_file)
>> The result is the following error message:
>> Impossible find the access point
>> ??0LTISceneBuffer@LizardTech@@QEAA@AEBVLTIPixel@1@IIPEAPEAX@ Z
>> into the dynamic link library lti_DSDK.dll
>>
>> Googling i have found this site:
>> Malware scan of gdal110.dll
>> Any help or suggestion? Thanks
>
> You have a reference to the ENVI object in your variable "e". Use this syntax instead:
>
> msi_raster = e.OpenRaster(msi_file)
>
> Jim P
Re: IDL-Python Bridge: problem with the ENVI function. [message #92920 is a reply to message #92919] Wed, 23 March 2016 10:49 Go to previous message
Jim  Pendleton is currently offline  Jim Pendleton
Messages: 165
Registered: November 2011
Senior Member
On Wednesday, March 23, 2016 at 9:57:37 AM UTC-6, lore...@gmail.com wrote:
> For Jim P.
> The sintax msi_raster=e.OpenRaster(msi_file) generate the same lti_dsdk.dll error.
>
> On Wednesday, March 23, 2016 at 3:37:48 PM UTC+1, Jim P wrote:
>> On Wednesday, March 23, 2016 at 5:46:29 AM UTC-6, lore...@gmail.com wrote:
>>> Hi all,
>>> my aim is to use a script written in IDL, into python:
>>>
>>> IDL code:
>>>
>>> PRO PS_GS
>>> ; Start the application
>>> e = ENVI()
>>> ;Generate the roi from a vector file
>>> ; Open a vector file
>>> file_vec = Filepath('Sic_Trapani.shp', ROOT_DIR = 'E:\mydirectory\')
>>> vettore = e.OpenVector(file_vec)
>>> ; Get the task from the catalog of ENVITasks
>>> Task_VtoR = ENVITask('VectorRecordsToROI')
>>> ; Define inputs
>>> Task_VtoR.INPUT_VECTOR = vettore
>>> ; Define outputs
>>> Task_VtoR.OUTPUT_ROI_URI = Filepath('roi_roi.xml', ROOT_DIR = 'E:\mydirectory\')
>>> ;Run the task
>>> Task_VtoR.Execute
>>> END
>>>
>>> The above code, launched into IDL command prompt, works correctly.
>>> I want make a python script that:
>>>
>>> - option 1) launch the above idl .pro script
>>> - option 2) use the IDL to Python Bridge sintax.
>>>
>>> In the first case, using the `subprocess.call("idldirectory\idl.exe")` command, i can open the IDL prompt into the windows command prompt. But i can not execute any IDL function like a simple `PRINT, 'hello'`.
>>>
>>> In the second case, i write the following poython code:
>>>
>>> import subprocess
>>> from subprocess import call
>>> import idlpy
>>> from idlpy import IDL
>>> e=IDL.ENVI()
>>> msi_file = """IDL.Filepath(mydata.tif", ROOT_DIR = 'mydirectory')"""
>>> msi_raster = IDL.OpenRaster(msi_file)
>>>
>>> The instruction `e=IDL.ENVI()` work correctly, in fact an Envi setion starts.
>>>
>>> The instruction `msi_file = """IDL.Filepath(mydata.tif", ROOT_DIR = 'mydirectory')"""` work correctly.
>>>
>>> My problem is with the OpenRaster instruction. It is an ENVI instruction and not an IDL instruction. So, IDL.OpenRaster does not work, and i do not have any solutions.
>>>
>>> I have modified the code like:
>>> msi_raster=IDL.ENVI().OpenRaster(msi_file)
>>> The result is the following error message:
>>> Impossible find the access point
>>> ??0LTISceneBuffer@LizardTech@@QEAA@AEBVLTIPixel@1@IIPEAPEAX@ Z
>>> into the dynamic link library lti_DSDK.dll
>>>
>>> Googling i have found this site:
>>> Malware scan of gdal110.dll
>>> Any help or suggestion? Thanks
>>
>> You have a reference to the ENVI object in your variable "e". Use this syntax instead:
>>
>> msi_raster = e.OpenRaster(msi_file)
>>
>> Jim P

This must be a platform specific bug. The LizardTech library is a 3rd party tool used to handle certain types of image compression.

Is the msi_raster object reference valid, in spite of the error message?

If you haven't done so already, please report this issue to support@exelisvis.com, along with the information about your platform and the format of the file you are attempting to read.

Jim P.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: barplot with 'vert_colors'
Next Topic: Re: plotting vectors on maps

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 09:10:29 PDT 2025

Total time taken to generate the page: 0.00417 seconds