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

Home » Public Forums » archive » New free DLL for calling Python from IDL!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: New free DLL for calling Python from IDL! [message #88334 is a reply to message #88332] Tue, 15 April 2014 11:16 Go to previous messageGo to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
Helder wrote:

> Dear Jason,
> I had a look at this again. I installed python 64 bit and still have the same
problem. I'll describe it again as follows:
> - Open IDL DE 64-bit, type random=pyimport("random") --> IDL closes suddenly.
No message. Too fast.
> - Open IDL command line, type the same command --> IDL closes. As above.
> - Python version: 64-bit. To check that, I did the following. I put in a file
called test.py the following lines:
>
> import struct
> print "n-bits=", struct.calcsize("P") * 8
>
> then I called from IDL the following:
> IDL> spawn, 'python test.py', out, err
> IDL> out, err
> n-bits= 64
>
> IDL> !version
> {
> ARCH: "x86_64",
> OS: "Win32",
> OS_FAMILY: "Windows",
> OS_NAME: "Microsoft Windows",
> RELEASE: "8.3",
> BUILD_DATE: "Nov 15 2013",
> MEMORY_BITS: 64,
> FILE_OFFSET_BITS: 64
> }
>
> So now the nr of bits of IDL and Python (version 2.7.6) match.
>
> Any clue why this is not working? Has anybody managed the windows 7 64-bit
installation?
>
> Regards,
> Helder


Hi Helder,

I can add a data point, if it's useful to know... on my Windows 7 64-bit, I have
Python 3 running, and this all works fine with the Python 3 tweak to test.py:

-----
import struct
print("n-bits=", struct.calcsize("P") * 8)
-----

IDL> spawn, 'python test.py', out, err
IDL> out,err
n-bits= 64

IDL> random=pyimport("random")
Slither 3.0, by Jacquette Consulting, Inc. Built on 2014-02-03 16:39:36.132000
Copyright (c) 2011 [...]
[...]
% Loaded DLM: SLITHER.
IDL> !version
{
ARCH: "x86_64",
OS: "Win32",
OS_FAMILY: "Windows",
OS_NAME: "Microsoft Windows",
RELEASE: "8.3",
BUILD_DATE: "Nov 15 2013",
MEMORY_BITS: 64,
FILE_OFFSET_BITS: 64
}
IDL> np=pyimport('numpy')
IDL> sp=pyimport('scipy')
IDL> np,sp
<ObjHeapVar3(PYTHONOBJECT)>
<ObjHeapVar4(PYTHONOBJECT)>

Cheers,
-Dick

Dick Jackson Software Consulting Inc.
Victoria, BC, Canada
www.d-jackson.com

-----

Bonus section:

In case you are tempted to jump to Python 3, here's how I did it, using
Miniconda3 and Anaconda. My recipe for getting Python 3.3 (I'm using Windows 7
64-bit, IDL 8.3 64-bit):

On http://continuum.io/blog/anaconda-python-3 , follow instructions for
Installing Miniconda3:

Go to this page:
http://repo.continuum.io/miniconda/index.html

Download the latest Miniconda3 for your OS, install it, then at a Command Prompt:
C:\> conda install anaconda

It will list the hundreds of things it will download and link, then tell it to
Proceed (type "y" then Enter)

Be patient! Then, at the command prompt, you should be able to start a Python
session and import numpy and scipy:
C:\>python
Python 3.3.4 |Anaconda 1.9.1 (64-bit)| (default, Feb 10 2014, 17:54:43) [MSC v.1
600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> import scipy as sp
>>> exit()

Test IDL and Slither (installed with correct DLM for Python 3.3):
IDL> DLM_LOAD('Slither')
Slither 3.0, by Jacquette Consulting, Inc. Built on 2014-02-03 16:39:36.132000
Copyright (c) [...]
IDL> np=pyimport('numpy')
IDL> sp=pyimport('scipy')


Helder wrote, On 2014-04-15, 9:22am:
> On Tuesday, March 4, 2014 2:00:51 PM UTC+1, Jason Ferrara wrote:
>> Is there any error message before the crash? If the workbench is closing right away before you get a chance to see any error messages try running from command line IDL.
>>
>>
>>
>> On Tuesday, March 4, 2014 3:29:51 AM UTC-5, Helder wrote:
>>
>>> On Tuesday, March 4, 2014 6:38:24 AM UTC+1, Chris Torrence wrote:
>>
>>>
>>
>>>> On Monday, March 3, 2014 7:18:19 PM UTC-7, Jeff N. wrote:
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> > Ronn,
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> > This is great news, thank you!!
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> > Unfortunately, I cannot get the DLM to load on either of my windows machines :( I have a 32-bit win8 machine, and a 64-bit win7 machine. Both are running IDL 8.2 and Python 2.7 (Specifically, the Python(x,y) installation). In both cases, attempting to call pyimport() to import any python module crashes IDL. It happens pretty quickly, so i feel like it's something simple, but not sure.
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> > Any ideas?
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> > Thanks,
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> > Jeff
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> >
>>
>>>
>>
>>>>
>>
>>>
>>
>>>>
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> Hi Jeff,
>>
>>>
>>
>>>>
>>
>>>
>>
>>>>
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> I believe that the DLM was built against IDL 8.3. It won't work against earlier versions of IDL because the symbol tables have changed. So you'll need to upgrade your IDL version before it will work.
>>
>>>
>>
>>>>
>>
>>>
>>
>>>>
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> For future versions of IDL, I'm trying to not change the symbol tables. So hopefully, when IDL 8.3.x comes out, we won't need a new build of Slither. I can't guarantee it, but that's the plan.
>>
>>>
>>
>>>>
>>
>>>
>>
>>>>
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> Cheers,
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> Chris
>>
>>>
>>
>>>>
>>
>>>
>>
>>>> ExelisVIS
>>
>>>
>>
>>>
>>
>>>
>>
>>> Hi,
>>
>>>
>>
>>> I have the same problem as Jeff (sudden crash when calling pyimport()).
>>
>>>
>>
>>> Using 8.3:
>>
>>>
>>
>>> IDL> !VERSION
>>
>>>
>>
>>> {
>>
>>>
>>
>>> ARCH: "x86_64",
>>
>>>
>>
>>> OS: "Win32",
>>
>>>
>>
>>> OS_FAMILY: "Windows",
>>
>>>
>>
>>> OS_NAME: "Microsoft Windows",
>>
>>>
>>
>>> RELEASE: "8.3",
>>
>>>
>>
>>> BUILD_DATE: "Nov 15 2013",
>>
>>>
>>
>>> MEMORY_BITS: 64,
>>
>>>
>>
>>> FILE_OFFSET_BITS: 64
>>
>>>
>>
>>> }
>>
>>>
>>
>>>
>>
>>>
>>
>>> Any ideas?
>>
>>>
>>
>>>
>>
>>>
>>
>>> Cheers,
>>
>>>
>>
>>> Helder
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: superresolution
Next Topic: How to find the confidence interval of a variable data at 95% or 66%?

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

Current Time: Wed Oct 08 17:33:31 PDT 2025

Total time taken to generate the page: 0.00493 seconds