python bug?? [message #91694] |
Thu, 13 August 2015 08:18  |
Dae-Kyu Shin
Messages: 25 Registered: February 2015
|
Junior Member |
|
|
pro test1
x = dindgen(3)*3
y = dindgen(3)*2
z = dindgen(3, 3)
python.run, 'from scipy import interpolate'
f = python.interpolate.interp2d(x, y, z)
newx = [1,2,3d]
newy = [4, 5, 6d]
print, f(newx, newy)
end
The test1.pro is not working
The error message is
% Compiled module: TEST1.
% Loaded DLM: PYTHON27.
% Python: Multiple array subscripts are not allowed.
% Execution halted at: TEST1 12 D:\IDL_package\IDLWorkspace85\Default\test1.pro
% $MAIN$
But then code was working when i copy and paste the code in command line.
|
|
|
Re: python bug?? [message #91705 is a reply to message #91694] |
Thu, 13 August 2015 14:31  |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Thursday, August 13, 2015 at 9:18:51 AM UTC-6, Dae-Kyu Shin wrote:
> pro test1
> x = dindgen(3)*3
> y = dindgen(3)*2
> z = dindgen(3, 3)
>
>
> python.run, 'from scipy import interpolate'
> f = python.interpolate.interp2d(x, y, z)
>
> newx = [1,2,3d]
> newy = [4, 5, 6d]
> print, f(newx, newy)
> end
>
> The test1.pro is not working
> The error message is
>
> % Compiled module: TEST1.
> % Loaded DLM: PYTHON27.
> % Python: Multiple array subscripts are not allowed.
> % Execution halted at: TEST1 12 D:\IDL_package\IDLWorkspace85\Default\test1.pro
> % $MAIN$
>
>
> But then code was working when i copy and paste the code in command line.
Try adding:
compile_opt idl2
at the top of your test1 procedure.
IDL will automatically add this at the command line if you use a static method, but it won't do that for procedures or functions.
Cheers,
Chris
|
|
|