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 
Switch to threaded view of this topic Create a new topic Submit Reply
New free DLL for calling Python from IDL! [message #87887] Mon, 03 March 2014 07:03 Go to next message
rlkling is currently offline  rlkling
Messages: 14
Registered: April 1999
Junior Member
Hello Everyone,

I am extremely pleased to announce that Exelisvis, Jacquette Consulting and myself have worked together to bring you the Slither dll for calling Python from IDL.

If you are familiar with Slither it was previously a paid for item. But we felt that it was of such potential use to the IDL community that we all worked together to provide it for free.

You can download it here.

www.slither4idl.com

There are dlls and shared objects for every platform IDL runs upon. Plus it supports Python versions, 2.6, 2.7 and 3.3.

Then, to help you over the learning curve you can order this eBook from my website for $5.00

http://www.rlkling.com/using-python-from-idl.htm

Don't worry if you don't have a kindle, there are free kindle readers for every platform that IDL supports. I'm really excited about using the eBook format and making this book a living document. According to Amazon when the eBook is updated you will get an email, and you can download the new version for free.

I also hope that the IDL community will send me examples of what they have done with Slither and I will add them to the book, with your name on the chapter.

We hope you enjoy this new dimension for IDL!

-Ronn Kling
Re: New free DLL for calling Python from IDL! [message #87893 is a reply to message #87887] Mon, 03 March 2014 08:32 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ronn Kling writes:

> We hope you enjoy this new dimension for IDL!

Goodness! I have enough trouble getting people to install ImageMagick.
You are very brave! ;-)

Cheers,

David

P.S. Is there a support hot-line?

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: New free DLL for calling Python from IDL! [message #87898 is a reply to message #87893] Mon, 03 March 2014 10:28 Go to previous messageGo to next message
ronn kling[1] is currently offline  ronn kling[1]
Messages: 16
Registered: March 2014
Junior Member
> Goodness! I have enough trouble getting people to install ImageMagick.
>
> You are very brave! ;-)
>

Just an eternal optimist.

>
>
>
> P.S. Is there a support hot-line?
>
>
That's the idea of a ever updating eBook. We keep it updated so that only one person has to figure it out.
Re: New free DLL for calling Python from IDL! [message #87899 is a reply to message #87898] Mon, 03 March 2014 11:02 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
ronn kling writes:

> That's the idea of a ever updating eBook. We keep it updated so that only one person has to figure it out.

You are an eternal optimist! I've made $9.75 on my e-book Standing on
the Ocean after everyone here told me "you should really write a book!"
I expected to get rich, but it turned into three months of work without
much pay-back. Hope you do better. In my experience, not too many people
read books these days. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: New free DLL for calling Python from IDL! [message #87900 is a reply to message #87887] Mon, 03 March 2014 11:29 Go to previous messageGo to next message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
Very nice Ronn. Bought the book, installed python and found a bug: IDL 8.3 crashes when .f (.full_session_reset) is issued after the DLM is load. To reproduce do

np=pyimport('numpi')
.f

Please fix!

Thank you ,
Haje



On Monday, March 3, 2014 10:03:51 AM UTC-5, ronn kling wrote:
> Hello Everyone,
>
>
>
> I am extremely pleased to announce that Exelisvis, Jacquette Consulting and myself have worked together to bring you the Slither dll for calling Python from IDL.
>
>
>
> If you are familiar with Slither it was previously a paid for item. But we felt that it was of such potential use to the IDL community that we all worked together to provide it for free.
>
>
>
> You can download it here.
>
>
>
> www.slither4idl.com
>
>
>
> There are dlls and shared objects for every platform IDL runs upon. Plus it supports Python versions, 2.6, 2.7 and 3.3.
>
>
>
> Then, to help you over the learning curve you can order this eBook from my website for $5.00
>
>
>
> http://www.rlkling.com/using-python-from-idl.htm
>
>
>
> Don't worry if you don't have a kindle, there are free kindle readers for every platform that IDL supports. I'm really excited about using the eBook format and making this book a living document. According to Amazon when the eBook is updated you will get an email, and you can download the new version for free.
>
>
>
> I also hope that the IDL community will send me examples of what they have done with Slither and I will add them to the book, with your name on the chapter.
>
>
>
> We hope you enjoy this new dimension for IDL!
>
>
>
> -Ronn Kling
Re: New free DLL for calling Python from IDL! [message #87901 is a reply to message #87900] Mon, 03 March 2014 11:47 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Monday, March 3, 2014 12:29:01 PM UTC-7, Haje Korth wrote:
> Very nice Ronn. Bought the book, installed python and found a bug: IDL 8.3 crashes when .f (.full_session_reset) is issued after the DLM is load. To reproduce do
>
>
>
> np=pyimport('numpi')
>
> .f
>
>
>
> Please fix!
>
>
>
> Thank you ,
>
> Haje
>
>
>

In Ronn's defense, I don't think he's going to be fixing any bugs in the code. That is Jaquette Consulting's responsibility. I would bet that they forgot to register a DLM "unload" routine for .full reset. So the DLM is probably being unloaded, but it isn't being given the chance to unload any of it's data structures. But it's free!

Cheers,
Chris
Re: New free DLL for calling Python from IDL! [message #87902 is a reply to message #87887] Mon, 03 March 2014 12:03 Go to previous messageGo to next message
PMan is currently offline  PMan
Messages: 61
Registered: January 2011
Member
On Monday, March 3, 2014 10:03:51 AM UTC-5, ronn kling wrote:
> Hello Everyone,
>
>
>
> I am extremely pleased to announce that Exelisvis, Jacquette Consulting and myself have worked together to bring you the Slither dll for calling Python from IDL.
>
>
>
> If you are familiar with Slither it was previously a paid for item. But we felt that it was of such potential use to the IDL community that we all worked together to provide it for free.
>
>
>
> You can download it here.
>
>
>
> www.slither4idl.com
>
>
>
> There are dlls and shared objects for every platform IDL runs upon. Plus it supports Python versions, 2.6, 2.7 and 3.3.
>
>
>
> Then, to help you over the learning curve you can order this eBook from my website for $5.00
>
>
>
> http://www.rlkling.com/using-python-from-idl.htm
>
>
>
> Don't worry if you don't have a kindle, there are free kindle readers for every platform that IDL supports. I'm really excited about using the eBook format and making this book a living document. According to Amazon when the eBook is updated you will get an email, and you can download the new version for free.
>
>
>
> I also hope that the IDL community will send me examples of what they have done with Slither and I will add them to the book, with your name on the chapter.
>
>
>
> We hope you enjoy this new dimension for IDL!
>
>
>
> -Ronn Kling

I was wondering what happened to Slither. I discovered some references to it on the web last year, but it just seemed to have vanished. I will check it out.
Re: New free DLL for calling Python from IDL! [message #87904 is a reply to message #87901] Mon, 03 March 2014 12:24 Go to previous messageGo to next message
ronn kling[1] is currently offline  ronn kling[1]
Messages: 16
Registered: March 2014
Junior Member
>
> In Ronn's defense, I don't think he's going to be fixing any bugs in the code. That is Jaquette Consulting's responsibility. I would bet that they forgot to register a DLM "unload" routine for .full reset. So the DLM is probably being unloaded, but it isn't being given the chance to unload any of it's data structures. But it's free!
>
>

So when you find bugs like this please email me at ronn@rlkling.com and I will add them to a list. At some point I want to have Jacquette Consulting add support for the Dictionary object that is new in 8.3.

Python also allows multiple return values like this
U,V,W = svd(array)
That I would somehow like to mimic in IDL maybe with returning a list or something.

And remember it is free!
Re: New free DLL for calling Python from IDL! [message #87905 is a reply to message #87901] Mon, 03 March 2014 12:41 Go to previous messageGo to next message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
Chris and Ronn,
I was not complaining, I was just reporting a bug. Without the source code I unfortunately cannot fix it myself. Also I was too excited to try this out without checking how the work was divided between Ronn and Jaquette Consulting.

Chris' possible explanation of a possibly missing unload routine makes sense. The DLM creators should read Ronn's book "Calling C from IDL" from which I learned how to do that. :-)

In any case, this is a great addition to IDL. Thank you for making it available!

Cheers,
Haje


On Monday, March 3, 2014 2:47:57 PM UTC-5, Chris Torrence wrote:
> On Monday, March 3, 2014 12:29:01 PM UTC-7, Haje Korth wrote:
>
>> Very nice Ronn. Bought the book, installed python and found a bug: IDL 8.3 crashes when .f (.full_session_reset) is issued after the DLM is load. To reproduce do
>
>>
>
>>
>
>>
>
>> np=pyimport('numpi')
>
>>
>
>> .f
>
>>
>
>>
>
>>
>
>> Please fix!
>
>>
>
>>
>
>>
>
>> Thank you ,
>
>>
>
>> Haje
>
>>
>
>>
>
>>
>
>
>
> In Ronn's defense, I don't think he's going to be fixing any bugs in the code. That is Jaquette Consulting's responsibility. I would bet that they forgot to register a DLM "unload" routine for .full reset. So the DLM is probably being unloaded, but it isn't being given the chance to unload any of it's data structures. But it's free!
>
>
>
> Cheers,
>
> Chris
Re: New free DLL for calling Python from IDL! [message #87906 is a reply to message #87904] Mon, 03 March 2014 12:41 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
ronn kling writes:

> And remember it is free!

Well, around here this generally means bug fixes within the hour. I
can't tell if you are using the term correctly or not. ;-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: New free DLL for calling Python from IDL! [message #87907 is a reply to message #87901] Mon, 03 March 2014 12:57 Go to previous messageGo to next message
Jason Ferrara is currently offline  Jason Ferrara
Messages: 17
Registered: February 2008
Junior Member
On Monday, March 3, 2014 2:47:57 PM UTC-5, Chris Torrence wrote:
>
> In Ronn's defense, I don't think he's going to be fixing any bugs in the code. That is Jaquette Consulting's responsibility. I would bet that they forgot to register a DLM "unload" routine for .full reset. So the DLM is probably being unloaded, but it isn't being given the chance to unload any of it's data structures. But it's free!
>

There is an exit handler registered and it attempts to do the right things.

I think this may be a numpy bug. See http://mail.scipy.org/pipermail/numpy-discussion/2009-March/ 040849.html
Re: New free DLL for calling Python from IDL! [message #87908 is a reply to message #87907] Mon, 03 March 2014 13:10 Go to previous messageGo to next message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
Hi Jason,
thanks for chiming in. I do not think that this is a bug in numpy as the same problem occurs with scipy:

sp=pyimport('scipy')
.f

also crashes IDL.

Cheers,
Haje

On Monday, March 3, 2014 3:57:44 PM UTC-5, Jason Ferrara wrote:
> On Monday, March 3, 2014 2:47:57 PM UTC-5, Chris Torrence wrote:
>
>>
>
>> In Ronn's defense, I don't think he's going to be fixing any bugs in the code. That is Jaquette Consulting's responsibility. I would bet that they forgot to register a DLM "unload" routine for .full reset. So the DLM is probably being unloaded, but it isn't being given the chance to unload any of it's data structures. But it's free!
>
>>
>
>
>
> There is an exit handler registered and it attempts to do the right things.
>
>
>
> I think this may be a numpy bug. See http://mail.scipy.org/pipermail/numpy-discussion/2009-March/ 040849.html
Re: New free DLL for calling Python from IDL! [message #87909 is a reply to message #87908] Mon, 03 March 2014 13:16 Go to previous messageGo to next message
Jason Ferrara is currently offline  Jason Ferrara
Messages: 17
Registered: February 2008
Junior Member
On Monday, March 3, 2014 4:10:25 PM UTC-5, Haje Korth wrote:
> Hi Jason,
>
> thanks for chiming in. I do not think that this is a bug in numpy as the same problem occurs with scipy:
>
>
>
> sp=pyimport('scipy')
>
> .f
>
>
>
> also crashes IDL.
>

Scipy includes numpy. But even without that, Slither uses numpy to represent IDL data types in Python. So just loading the Slither DLM causes numpy to get imported.
Re: New free DLL for calling Python from IDL! [message #87910 is a reply to message #87909] Mon, 03 March 2014 13:28 Go to previous messageGo to next message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
I see, thanks Jason. Then I am not sure what to do about that. Haje

On Monday, March 3, 2014 4:16:48 PM UTC-5, Jason Ferrara wrote:
> On Monday, March 3, 2014 4:10:25 PM UTC-5, Haje Korth wrote:
>
>> Hi Jason,
>
>>
>
>> thanks for chiming in. I do not think that this is a bug in numpy as the same problem occurs with scipy:
>
>>
>
>>
>
>>
>
>> sp=pyimport('scipy')
>
>>
>
>> .f
>
>>
>
>>
>
>>
>
>> also crashes IDL.
>
>>
>
>
>
> Scipy includes numpy. But even without that, Slither uses numpy to represent IDL data types in Python. So just loading the Slither DLM causes numpy to get imported.
Re: New free DLL for calling Python from IDL! [message #87911 is a reply to message #87887] Mon, 03 March 2014 13:29 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rlkling@gmail.com writes:

> I am extremely pleased to announce that Exelisvis, Jacquette Consulting and myself have worked together to bring you the Slither dll for calling Python from IDL.
>
> If you are familiar with Slither it was previously a paid for item. But we felt that it was of such potential use to the IDL community that we all worked together to provide it for free.

I'm not really familiar with Slither, but I know Python a bit. What is
confusing me is why IDL and Python together are that much better than
either one of them alone. What do these two packages bring as a dowry to
the marriage?

Is this for people who know both languages and can't decide if they are
Catholic or Episcopalian?

This isn't the next new graphics system, is it?

Just a tad confused, I guess. Probably has to do with age. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: New free DLL for calling Python from IDL! [message #87912 is a reply to message #87911] Mon, 03 March 2014 13:52 Go to previous messageGo to next message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
Well, as a Lutheran, I can still appreciate the beautiful art in Italian Catholic churches. And it's similar with Python. I am not and will never be a regular Python user. But the fact the Python user base is growing is undeniable. I can see it in the offices around me. So the ability to be able to use those folk's functions without recoding everything sounds appealing to me. (Don't know much about python or slither at this point. In fact, I heard of Slither the first time today.)


On Monday, March 3, 2014 4:29:15 PM UTC-5, David Fanning wrote:
> rlkling@gmail.com writes:
>
>
>
>> I am extremely pleased to announce that Exelisvis, Jacquette Consulting and myself have worked together to bring you the Slither dll for calling Python from IDL.
>
>>
>
>> If you are familiar with Slither it was previously a paid for item. But we felt that it was of such potential use to the IDL community that we all worked together to provide it for free.
>
>
>
> I'm not really familiar with Slither, but I know Python a bit. What is
>
> confusing me is why IDL and Python together are that much better than
>
> either one of them alone. What do these two packages bring as a dowry to
>
> the marriage?
>
>
>
> Is this for people who know both languages and can't decide if they are
>
> Catholic or Episcopalian?
>
>
>
> This isn't the next new graphics system, is it?
>
>
>
> Just a tad confused, I guess. Probably has to do with age. :-)
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: New free DLL for calling Python from IDL! [message #87913 is a reply to message #87911] Mon, 03 March 2014 14:22 Go to previous messageGo to next message
Jason Ferrara is currently offline  Jason Ferrara
Messages: 17
Registered: February 2008
Junior Member
There are many 3rd party libraries available for Python but not IDL. Slither gives you access to those libraries.

We've also found it quite useful for writing "DLMs" for interfacing IDL with data acquisition hardware where multithreading is required. Rather that writing a normal C/C++ dlm, where you have to write the hardware control code and the IDL interface code, you can write the hardware control library in Python, and then with Slither call that library directly without writing any additional interface code.

On Monday, March 3, 2014 4:29:15 PM UTC-5, David Fanning wrote:
>
>
>
> I'm not really familiar with Slither, but I know Python a bit. What is
>
> confusing me is why IDL and Python together are that much better than
>
> either one of them alone. What do these two packages bring as a dowry to
>
> the marriage?
>
>
>
> Is this for people who know both languages and can't decide if they are
>
> Catholic or Episcopalian?
>
>
>
> This isn't the next new graphics system, is it?
>
>
>
> Just a tad confused, I guess. Probably has to do with age. :-)
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: New free DLL for calling Python from IDL! [message #87914 is a reply to message #87913] Mon, 03 March 2014 15:12 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jason Ferrara writes:

> There are many 3rd party libraries available for Python but not IDL. Slither gives you access to those libraries.

Thank you. Just to clarify, you are saying then that Slither gives you
access to Python libraries without the overhead of having to learn much
Python? Non-expert python programmers might use Python libraries, but in
their preferred IDL programming language. Do I understand that right?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: New free DLL for calling Python from IDL! [message #87915 is a reply to message #87914] Mon, 03 March 2014 15:22 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Well, here's another example that might put both me and David out of business. I installed the Anaconda (python 2.7 package), which comes with all of the matplotlib libraries.

This example is taken directly from the matplotlib gallery page:
http://matplotlib.org/examples/pie_and_polar_charts/pie_demo _features.html

Create a pie chart from within IDL:

plt = pyimport("matplotlib.pyplot")
sizes = [15,30,45,10]
labels = ['Frogs', 'Hogs', 'Dogs', 'Logs']
colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
explode = [0, 0.1, 0, 0]
p = plt.pie(sizes, explode=explode, labels=labels, colors=colors, $
autopct='%1.1f%%', shadow=1, startangle=90)
void = plt.axis('equal')
void = plt.show(block=0)
void = plt.savefig('plot.pdf')

But here's a question for Jason or Ronn: once I've created the "p" object, it says it is a "tuple". Is there any way to get properties back out of the object? I tried the following:
IDL> pb = pyimportbuiltins()
IDL> pb.getattr(p,'colors')
% PYTHONOBJECT::GETATTR: AttributeError: 'tuple' object has no attribute 'colors'

Cheers,
Chris
ExelisVIS
Re: New free DLL for calling Python from IDL! [message #87916 is a reply to message #87914] Mon, 03 March 2014 15:24 Go to previous messageGo to next message
ronn kling[1] is currently offline  ronn kling[1]
Messages: 16
Registered: March 2014
Junior Member
Right, the syntax differences between IDL 8.+ and Python are very small. So if you are looking at this code you can't tell if it is Python or IDL

derfilt = np.array([1.0,-2,1.0])

So an IDL user can use Python libraries with out a lot of learning overhead. That is why I went through all the examples in the eBook so users can see what little tweaks they need to get access to the Python libs that they want.
Re: New free DLL for calling Python from IDL! [message #87917 is a reply to message #87915] Mon, 03 March 2014 15:37 Go to previous messageGo to next message
ronn kling[1] is currently offline  ronn kling[1]
Messages: 16
Registered: March 2014
Junior Member
> But here's a question for Jason or Ronn: once I've created the "p" object, it says it is a "tuple". Is there any way to get properties back out of the object? I tried the following:
>
> IDL> pb = pyimportbuiltins()
>
> IDL> pb.getattr(p,'colors')
>
> % PYTHONOBJECT::GETATTR: AttributeError: 'tuple' object has no attribute 'colors'
>
Jason may have a better way but what I would do is pull the tuple apart into separate variables on the python side using pyexec and then get them back one at a time.

This is exactly the case where maybe at some point we can get Jason to mod Slither to return something like a Dictionary object.
Re: New free DLL for calling Python from IDL! [message #87918 is a reply to message #87917] Mon, 03 March 2014 15:40 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Monday, March 3, 2014 4:37:09 PM UTC-7, ronn kling wrote:
>> But here's a question for Jason or Ronn: once I've created the "p" object, it says it is a "tuple". Is there any way to get properties back out of the object? I tried the following:
>
>>
>
>> IDL> pb = pyimportbuiltins()
>
>>
>
>> IDL> pb.getattr(p,'colors')
>
>>
>
>> % PYTHONOBJECT::GETATTR: AttributeError: 'tuple' object has no attribute 'colors'
>
>>
>
> Jason may have a better way but what I would do is pull the tuple apart into separate variables on the python side using pyexec and then get them back one at a time.
>
>
>
> This is exactly the case where maybe at some point we can get Jason to mod Slither to return something like a Dictionary object.

Yes. What I want to do is just:
print, p.colors
Then it will really look like IDL code, and we'll all be horribly confused. :-)
-C
Re: New free DLL for calling Python from IDL! [message #87919 is a reply to message #87915] Mon, 03 March 2014 15:56 Go to previous messageGo to next message
Jason Ferrara is currently offline  Jason Ferrara
Messages: 17
Registered: February 2008
Junior Member
IDL> p = plt.pie(sizes, explode=explode, labels=labels, colors=colors, $
> autopct='%1.1f%%', shadow=1, startangle=90)
IDL> print, p
([<matplotlib.patches.Wedge object at 0x0000000017D6F320>, <matplotlib.patches.Wedge object at 0x0000000018200B00>, <matplotlib.patches.Wedge object at 0x000000001820B320>, <matplotlib.patches.Wedge object at 0x0000000018210B00>], [<matplotlib.text.Text object at 0x0000000017D6FFD0>, <matplotlib.text.Text object at 0x00000000182077F0>, <matplotlib.text.Text object at 0x000000001820BFD0>, <matplotlib.text.Text object at 0x00000000182177F0>], [<matplotlib.text.Text object at 0x00000000182005C0>, <matplotlib.text.Text object at 0x0000000018207DA0>, <matplotlib.text.Text object at 0x00000000182105C0>, <matplotlib.text.Text object at 0x0000000018217DA0>])
IDL> print, p[0]
[<matplotlib.patches.Wedge object at 0x0000000017D6F320>, <matplotlib.patches.Wedge object at 0x0000000018200B00>, <matplotlib.patches.Wedge object at 0x000000001820B320>, <matplotlib.patches.Wedge object at 0x0000000018210B00>]
IDL> print, p[1]
[<matplotlib.text.Text object at 0x0000000017D6FFD0>, <matplotlib.text.Text object at 0x00000000182077F0>, <matplotlib.text.Text object at 0x000000001820BFD0>, <matplotlib.text.Text object at 0x00000000182177F0>]
IDL> print, (p[1])[0].get_text()
Frogs
IDL> print, (p[1])[2].get_text()
Dogs
IDL>

On Monday, March 3, 2014 6:22:34 PM UTC-5, Chris Torrence wrote:
> Well, here's another example that might put both me and David out of business. I installed the Anaconda (python 2.7 package), which comes with all of the matplotlib libraries.
>
>
>
> This example is taken directly from the matplotlib gallery page:
>
> http://matplotlib.org/examples/pie_and_polar_charts/pie_demo _features.html
>
>
>
> Create a pie chart from within IDL:
>
>
>
> plt = pyimport("matplotlib.pyplot")
>
> sizes = [15,30,45,10]
>
> labels = ['Frogs', 'Hogs', 'Dogs', 'Logs']
>
> colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
>
> explode = [0, 0.1, 0, 0]
>
> p = plt.pie(sizes, explode=explode, labels=labels, colors=colors, $
>
> autopct='%1.1f%%', shadow=1, startangle=90)
>
> void = plt.axis('equal')
>
> void = plt.show(block=0)
>
> void = plt.savefig('plot.pdf')
>
>
>
> But here's a question for Jason or Ronn: once I've created the "p" object, it says it is a "tuple". Is there any way to get properties back out of the object? I tried the following:
>
> IDL> pb = pyimportbuiltins()
>
> IDL> pb.getattr(p,'colors')
>
> % PYTHONOBJECT::GETATTR: AttributeError: 'tuple' object has no attribute 'colors'
>
>
>
> Cheers,
>
> Chris
>
> ExelisVIS
Re: New free DLL for calling Python from IDL! [message #87920 is a reply to message #87918] Mon, 03 March 2014 16:06 Go to previous messageGo to next message
Jason Ferrara is currently offline  Jason Ferrara
Messages: 17
Registered: February 2008
Junior Member
And to get colors of the wedges...

IDL> print, (p[0])[0].get_edgecolor()
0.00000000 0.00000000 0.00000000 1.0000000
IDL> print, (p[0])[0].get_facecolor()
0.60392157 0.80392157 0.19607843 1.0000000
IDL>

On Monday, March 3, 2014 6:40:29 PM UTC-5, Chris Torrence wrote:
> On Monday, March 3, 2014 4:37:09 PM UTC-7, ronn kling wrote:
>
>>> But here's a question for Jason or Ronn: once I've created the "p" object, it says it is a "tuple". Is there any way to get properties back out of the object? I tried the following:
>
>
>
> Yes. What I want to do is just:
>
> print, p.colors
>
> Then it will really look like IDL code, and we'll all be horribly confused. :-)
>
> -C
Re: New free DLL for calling Python from IDL! [message #87923 is a reply to message #87887] Mon, 03 March 2014 18:18 Go to previous messageGo to next message
jeffnettles4870 is currently offline  jeffnettles4870
Messages: 111
Registered: October 2006
Senior Member
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

On Monday, March 3, 2014 10:03:51 AM UTC-5, ronn kling wrote:
> Hello Everyone,
>
>
>
> I am extremely pleased to announce that Exelisvis, Jacquette Consulting and myself have worked together to bring you the Slither dll for calling Python from IDL.
>
>
>
> If you are familiar with Slither it was previously a paid for item. But we felt that it was of such potential use to the IDL community that we all worked together to provide it for free.
>
>
>
> You can download it here.
>
>
>
> www.slither4idl.com
>
>
>
> There are dlls and shared objects for every platform IDL runs upon. Plus it supports Python versions, 2.6, 2.7 and 3.3.
>
>
>
> Then, to help you over the learning curve you can order this eBook from my website for $5.00
>
>
>
> http://www.rlkling.com/using-python-from-idl.htm
>
>
>
> Don't worry if you don't have a kindle, there are free kindle readers for every platform that IDL supports. I'm really excited about using the eBook format and making this book a living document. According to Amazon when the eBook is updated you will get an email, and you can download the new version for free.
>
>
>
> I also hope that the IDL community will send me examples of what they have done with Slither and I will add them to the book, with your name on the chapter.
>
>
>
> We hope you enjoy this new dimension for IDL!
>
>
>
> -Ronn Kling
Re: New free DLL for calling Python from IDL! [message #87924 is a reply to message #87923] Mon, 03 March 2014 21:38 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
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
Re: New free DLL for calling Python from IDL! [message #87925 is a reply to message #87920] Mon, 03 March 2014 21:40 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Monday, March 3, 2014 5:06:24 PM UTC-7, Jason Ferrara wrote:
> And to get colors of the wedges...
>
>
>
> IDL> print, (p[0])[0].get_edgecolor()
>
> 0.00000000 0.00000000 0.00000000 1.0000000
>
> IDL> print, (p[0])[0].get_facecolor()
>
> 0.60392157 0.80392157 0.19607843 1.0000000
>
> IDL>
>
>
>
> On Monday, March 3, 2014 6:40:29 PM UTC-5, Chris Torrence wrote:
>
>> On Monday, March 3, 2014 4:37:09 PM UTC-7, ronn kling wrote:
>
>>
>
>>>> But here's a question for Jason or Ronn: once I've created the "p" object, it says it is a "tuple". Is there any way to get properties back out of the object? I tried the following:
>
>>
>
>>
>
>>
>
>> Yes. What I want to do is just:
>
>>
>
>> print, p.colors
>
>>
>
>> Then it will really look like IDL code, and we'll all be horribly confused. :-)
>
>>
>
>> -C

Thanks Jason for the response! I'm having lots of fun playing with python & IDL.
-Chris
Re: New free DLL for calling Python from IDL! [message #87926 is a reply to message #87924] Tue, 04 March 2014 00:29 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
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
Re: New free DLL for calling Python from IDL! [message #87927 is a reply to message #87887] Tue, 04 March 2014 00:30 Go to previous messageGo to next message
markb77 is currently offline  markb77
Messages: 217
Registered: July 2006
Senior Member
cool! I'm looking forward to trying it out. Many thanks!
Mark
Re: New free DLL for calling Python from IDL! [message #87928 is a reply to message #87915] Tue, 04 March 2014 04:50 Go to previous messageGo to next message
Jason Ferrara is currently offline  Jason Ferrara
Messages: 17
Registered: February 2008
Junior Member
Here is an example showing how to create a plot with matplotlib and display it in IDL without needing to save the plot to a temporary file.

plt = pyimport("matplotlib.pyplot")
mpagg = pyimport("matplotlib.backends.backend_agg")
fig = plt.figure(facecolor='w')
canvas = mpagg.FigureCanvasAgg(fig)
ax=fig.add_subplot(111)
ax.plot, [1,2,3]
stringio = pyimport("cStringIO")
numpy = pyimport("numpy")
imgdata = stringio.StringIO()
canvas.print_rgba, imgdata
w = (canvas.get_width_height())[0]
h = (canvas.get_width_height())[1]
img = (numpy.fromstring(imgdata.getvalue(), dtype=numpy.uint8, /pyobj)).reshape([h,w,4])
img = reverse(img(1:3,*,*),3)
tv, img, /true
Re: New free DLL for calling Python from IDL! [message #87929 is a reply to message #87926] Tue, 04 March 2014 05:00 Go to previous messageGo to next message
Jason Ferrara is currently offline  Jason Ferrara
Messages: 17
Registered: February 2008
Junior Member
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
Re: New free DLL for calling Python from IDL! [message #87930 is a reply to message #87924] Tue, 04 March 2014 05:05 Go to previous messageGo to next message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
Chris,
are you sure this is correct? I just built my Geopack DLM on IDL 8.3 and it runs fine on IDL 8.2.3. I have not checked other IDL versions but when running 8.2.3 I am pretty confident that DLM code compiled for that version runs on IDL all the way back to 6.4. In 6.4 there was a significant change in the API and I remember many people including myself being upset because compiling for different OS AND differen IDL versions results in just too many permutations of the executables that are difficult to maintain.

Haje

On Tuesday, March 4, 2014 12:38:24 AM UTC-5, 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
Re: New free DLL for calling Python from IDL! [message #87931 is a reply to message #87929] Tue, 04 March 2014 05:08 Go to previous messageGo to next message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
Following on my last comment to Chris, I just have tested slither on IDL 8.2.3 and it indeed crashes the DE when typing np=pyinport('numpy') after spitting out the slither info notice. There is no further debug info.

On Tuesday, March 4, 2014 8:00:51 AM UTC-5, 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
Re: New free DLL for calling Python from IDL! [message #87932 is a reply to message #87929] Tue, 04 March 2014 05:11 Go to previous messageGo to next message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
I tried the command line version of 8.2.3 as well and there is no further info either. The last line is "%Loaded DLM: Slither" then the message box "IDL has stopped working" pops up.

On Tuesday, March 4, 2014 8:00:51 AM UTC-5, 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
Re: New free DLL for calling Python from IDL! [message #87933 is a reply to message #87929] Tue, 04 March 2014 05:22 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
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

Dear Jason,
thank for looking into this. No, there is no message. Simply closes the IDL DE. In the command line the same happens.

IDL>np = pyimport("numpy")


C:\Program Files\Exelis\IDL83\bin\bin.x86_64>
C:\Program Files\Exelis\IDL83\bin\bin.x86_64>python --version
Python 2.7.5

C:\Program Files\Exelis\IDL83\bin\bin.x86_64>python
..
>> import numpy as np
>>
>> exit()

So, I get no "%Loaded DLM:xxx" message or any other info.

I went a bit further and installed the 32-bit version in the 32-bit IDL directory and in this case I could use python...

My guess at this moment is that I was using IDL 64-bit and trying to use 32-bit Python. (To check the version just type python at the command line)
32-bit IDL works fine (as far as I tested) with 32-bit python.

Cheers,
Helder
Re: New free DLL for calling Python from IDL! [message #87934 is a reply to message #87933] Tue, 04 March 2014 05:34 Go to previous messageGo to next message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
I agree, bittage of IDL and Python have to match, I ran into that problem first yesterday. However, for me slither does not load 32 bit python on 32-bit IDL 8.2.3. It does load on IDL 8.3.

Maybe Chris does have a point with the changes in the API. Maybe the changes are such that only some functionality is affected. That would explain why my own DLMs run without chnages across these DLM versions.


On Tuesday, March 4, 2014 8:22:20 AM UTC-5, Helder wrote:
> 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
>
>
>
> Dear Jason,
>
> thank for looking into this. No, there is no message. Simply closes the IDL DE. In the command line the same happens.
>
>
>
> IDL>np = pyimport("numpy")
>
>
>
>
>
> C:\Program Files\Exelis\IDL83\bin\bin.x86_64>
>
> C:\Program Files\Exelis\IDL83\bin\bin.x86_64>python --version
>
> Python 2.7.5
>
>
>
> C:\Program Files\Exelis\IDL83\bin\bin.x86_64>python
>
> ..
>
>>> import numpy as np
>
>>>
>
>>> exit()
>
>
>
> So, I get no "%Loaded DLM:xxx" message or any other info.
>
>
>
> I went a bit further and installed the 32-bit version in the 32-bit IDL directory and in this case I could use python...
>
>
>
> My guess at this moment is that I was using IDL 64-bit and trying to use 32-bit Python. (To check the version just type python at the command line)
>
> 32-bit IDL works fine (as far as I tested) with 32-bit python.
>
>
>
> Cheers,
>
> Helder
Re: New free DLL for calling Python from IDL! [message #87935 is a reply to message #87929] Tue, 04 March 2014 05:34 Go to previous messageGo to next message
jeffnettles4870 is currently offline  jeffnettles4870
Messages: 111
Registered: October 2006
Senior Member
Jason: No, I don't get any further information, just the dreaded "IDL has stopped working" message :(

Chris: I'm an ENVI user - I think you guys were putting out an ENVI service pack every time IDL upgrades so that we could use the most current IDL, but I don't think there's a new ENVI service pack for IDL 8.3 is there? For that I'd need ENVI 5.1 I think, correct?
Re: New free DLL for calling Python from IDL! [message #87943 is a reply to message #87935] Tue, 04 March 2014 19:27 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Tuesday, March 4, 2014 6:34:35 AM UTC-7, Jeff N. wrote:
> Jason: No, I don't get any further information, just the dreaded "IDL has stopped working" message :(
>
>
>
> Chris: I'm an ENVI user - I think you guys were putting out an ENVI service pack every time IDL upgrades so that we could use the most current IDL, but I don't think there's a new ENVI service pack for IDL 8.3 is there? For that I'd need ENVI 5.1 I think, correct?

Hi Jeff,

Actually, it's usually the other way around these days. When we do a new release of ENVI, then we release IDL as well. :-)

And you're correct, ENVI 5.1 goes along with IDL 8.3. So you would need to upgrade both.

Also, following on Haje's post, yes, it totally depends upon what symbols you use. If you look at the bottom of the idl_export.h file (in the distribution), you'll see all the exported symbols. Occasionally, we will insert a new symbol into the middle of that list, which will move all of the other symbols down. So as long as you aren't using any symbols below the new one, you will get lucky and your DLM will work correctly. Before IDL 8.3, we weren't really being careful about where we inserted symbols, and just assumed that users would need to recompile their DLM's for each release. Now, we'll try to be more careful. Even so, there's still a possibility that Slither (and other DLM's) won't work correctly in a new version unless they are recompiled.

Cheers,
Chris
ExelisVIS
Re: New free DLL for calling Python from IDL! [message #87952 is a reply to message #87913] Wed, 05 March 2014 09:19 Go to previous messageGo to next message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
Jason Ferrara wrote, On 2014-03-03, 2:22pm:> There are many 3rd party libraries
available for Python but not IDL. Slither gives you access to those libraries.
>
> We've also found it quite useful for writing "DLMs" for interfacing IDL with
data acquisition hardware where multithreading is required. Rather that writing
a normal C/C++ dlm, where you have to write the hardware control code and the
IDL interface code, you can write the hardware control library in Python, and
then with Slither call that library directly without writing any additional
interface code.

[aside:]

When Slither was being born, I was standing outside the delivery room...

A client of mine needed some serious hardware interfacing done so that our
programs could control these devices from IDL. He found Jason to do the job, and
rather than implement a one-off DLL, (if I remember correctly) Jason figured,
"why not just develop a complete Python-IDL interface at the same time?" So,
thanks to that forward-thinking move (which paid off well), and contributions of
Ronn Kling and Exelis VIS, we now enjoy the spin-off technology.

--

Cheers,
-Dick

Dick Jackson Software Consulting Inc.
Victoria, BC, Canada
www.d-jackson.com
Re: New free DLL for calling Python from IDL! [message #87953 is a reply to message #87943] Wed, 05 March 2014 11:02 Go to previous messageGo to next message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
Chris.
this makes perfect sense and explains the differences in behavior of my and the Slither DLMs between different IDL versions. I only use the simple stuff (no pointer), which my brain can process! In that case, it seems to make common sense that new symbols should always be appended at the end, where it would not affect old code. I guess that is what you meant with being more careful where you insert the new symbol.

Cheers,
Haje

On Tuesday, March 4, 2014 10:27:34 PM UTC-5, Chris Torrence wrote:
> Also, following on Haje's post, yes, it totally depends upon what symbols you use. If you look at the bottom of the idl_export.h file (in the distribution), you'll see all the exported symbols. Occasionally, we will insert a new symbol into the middle of that list, which will move all of the other symbols down. So as long as you aren't using any symbols below the new one, you will get lucky and your DLM will work correctly. Before IDL 8.3, we weren't really being careful about where we inserted symbols, and just assumed that users would need to recompile their DLM's for each release. Now, we'll try to be more careful. Even so, there's still a possibility that Slither (and other DLM's) won't work correctly in a new version unless they are recompiled.
>
>
>
> Cheers,
>
> Chris
>
> ExelisVIS
Re: New free DLL for calling Python from IDL! [message #88332 is a reply to message #87929] Tue, 15 April 2014 09:22 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
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

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
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 next 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
>
Re: New free DLL for calling Python from IDL! [message #88339 is a reply to message #88332] Tue, 15 April 2014 12:53 Go to previous messageGo to next message
yuxipang is currently offline  yuxipang
Messages: 3
Registered: April 2014
Junior Member
Hi Helder,

I can run the codes (see below) provided by Chris Torrence on my OS64 Win7 laptop. I put the Slither.DLL and Slither.DLM in a separate directory on the IDL path, and added the following lines in the startup.pro file (based on suggestions from Ronn Kline's ebook).

PREF_SET, 'IDL_DLM_PATH', 'C:\WorkSpace\IDL\Slither\python33; <IDL_DEFAULT>', /COMMIT

When I put slither DLL/DLM files in the directory of C:\Program Files\Exelis\IDL83\bin\bin.x86_64\, it did not work for me.

The standard Python 3.3.3 and its extension packages (matplotlib, numpy and others)were downloaded from following sites ...
https://www.python.org/downloads/
http://www.lfd.uci.edu/~gohlke/pythonlibs/

========================================
plt = pyimport("matplotlib.pyplot")
sizes = [15,30,45,10]
labels = ['Frogs', 'Hogs', 'Dogs', 'Logs']
colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
explode = [0, 0.1, 0, 0]
p = plt.pie(sizes, explode=explode, labels=labels, colors=colors, $
autopct='%1.1f%%', shadow=1, startangle=90)
void = plt.axis('equal')
void = plt.show(block=1) ; block=0 used by Chris
=======================================
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
}
========================================

Hope this helps, if you have any additional questions, please send me an email.

Yuxi
Re: New free DLL for calling Python from IDL! [message #88340 is a reply to message #88339] Tue, 15 April 2014 13:29 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
yuxipang@gmail.com writes:

> I can run the codes (see below) provided by Chris Torrence on my OS64 Win7 laptop. I put the Slither.DLL and Slither.DLM in a separate directory on the IDL path, and added the following lines in the startup.pro file (based on suggestions from Ronn Kline's ebook).
>
> PREF_SET, 'IDL_DLM_PATH', 'C:\WorkSpace\IDL\Slither\python33; <IDL_DEFAULT>', /COMMIT
>
> When I put slither DLL/DLM files in the directory of C:\Program Files\Exelis\IDL83\bin\bin.x86_64\, it did not work for me.

This makes some sense to me, because Windows 7 doesn't like it when you
try to write into someone else's directory like this. It *appears* to
allow it, but even if you are an administrator of your machine, it
doesn't really work. I think it is a file permission thing. I don't know
the details.

For example, if I find a bug in an IDL library program and fix it, I can
"save" it back into the IDL lib directory. All appears normal. But, I
can't actually "run" the new version of the program, because it wasn't
*really* saved there. I have to save it in a directory I own and use it
from there.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: New free DLL for calling Python from IDL! [message #88369 is a reply to message #87887] Thu, 17 April 2014 09:53 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Hi Helder,

If I recall, I had some problems with the stock python. I then tried Anaconda and the Slither dlm worked fine first time. I'm on a Mac.

Note: I just dropped the Slither dlm/dll/so straight into IDL's 64-bit bin directory, so I didn't have to worry about changing dlm_path. It would probably work fine outside of the bin directory, but I just wanted to get it working first.

Cheers,
Chris
Re: New free DLL for calling Python from IDL! [message #88454 is a reply to message #87887] Mon, 28 April 2014 12:06 Go to previous messageGo to next message
Jason Ferrara is currently offline  Jason Ferrara
Messages: 17
Registered: February 2008
Junior Member
Paths shouldn't matter. The standard Python windows installers drop a dll into \Windows\system32. The name of the dll includes the Python version, so that installs of different Python versions can coexist. When Slither loads it loads appropriate dll from \Windows\system32, and then the dll knows how to find the rest of the Python install.

Make sure that if you start Python from the command line you can do "import numpy" without it crashing. If there is something wrong with your numpy install Slither won't load correctly.

On Tuesday, April 15, 2014 7:06:13 PM UTC-4, Helder wrote:
>
>
> Hi,
>
> well, first thanks to all Dick, Yuxi and David.
>
> Unfortunately, it's still not working. Here is the summary of what I have tried.
>
>
>
> I installed python 2.7 and 3.3 (WinPython). I made sure I had the right path for the right test. Meaning if I started python from the command line I would either get version 2.7 or 3.3 depending on how I modified the windows path.
>
>
>
> I made new directories where I put the Slither dll and dlm files (for versions 2.7 and 3.3 in separate dirs!).
>
>
>
> Removed the old Slither dll and dlm files.
>
>
>
> Tried pyimport and without setting the path and it did not work as expected.
>
> I set the path in IDL and windows to python 2.7 and Slither and tried pyimport -> sudden crash. No info, no warning.
>
>
>
> Same happens for python 3.3.
>
>
>
> If I remove the windows path, so that I cannot start python from the command line without going in the specific directory, I still get a total crash. So apparently it isn't even getting to start python or communicate with it.
>
>
>
> Although it's pretty late (1 am), I'm quite sure I didn't screw up the paths in windows and idl. I double checked this in windows from the command line and in idl I made restarted.
>
>
>
> I'll think about this tomorrow, but I don't see how Anaconda could be better/different.
>
>
>
> Thanks again for your help.
>
>
>
> 'night,
>
> Helder
Re: New free DLL for calling Python from IDL! [message #89186 is a reply to message #87887] Thu, 31 July 2014 03:51 Go to previous messageGo to next message
Matt[3] is currently offline  Matt[3]
Messages: 23
Registered: April 2011
Junior Member
Hi All,

This sounds like a great project! However, I seem to be running into trouble straight away... Apologies if I'm doing something stupid here:

I have Anaconda 2.0.1 installed on a 64bit Linux machine, using Python 2.7.8, numpy 1.8.1 and IDL 8.3. I've copied the 64 bit Linux Slither.so and Slither.dlm files into my bin.linux.x86_64 folder (which is what shows up when I do PRINT, EXPAND_PATH('<IDL_DEFAULT_DLM>')). However, when I try to run the first example in the documentation, I get:

IDL> random=pyimport("random")
ImportError: No module named numpy
% Dynamically loadable module failed to load: SLITHER.
% Execution halted at: $MAIN$

To check that IDL sees the same version of Python as the system does:
IDL> spawn, 'python -c "import platform; print platform.python_version()"'
2.7.8

And just to check that numpy can be imported:
IDL> spawn, 'python -c "import numpy; print numpy.zeros(2)"
[ 0. 0.]

Am I missing something obvious here?

Thanks in advance,

Matt
Re: New free DLL for calling Python from IDL! [message #89187 is a reply to message #89186] Thu, 31 July 2014 04:00 Go to previous messageGo to next message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Hi,

On 31.07.2014 12:51, Matt wrote:
> IDL> spawn, 'python -c "import platform; print platform.python_version()"'
> 2.7.8

Jus to be sure, what happens when you do:

IDL> py = pyimport('__main__')
IDL> py->exec, 'print(sys.version)'
IDL> py->exec, 'import numpy'

?
Re: New free DLL for calling Python from IDL! [message #89188 is a reply to message #89187] Thu, 31 July 2014 04:01 Go to previous messageGo to next message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
oops, I meant:

IDL> py = pyimport('__main__')
IDL> py->exec, 'import sys'
IDL> py->exec, 'print(sys.version)'
IDL> py->exec, 'import numpy'

On 31.07.2014 13:00, Fabien wrote:
> IDL> py = pyimport('__main__')
> IDL> py->exec, 'print(sys.version)'
> IDL> py->exec, 'import numpy'
Re: New free DLL for calling Python from IDL! [message #89189 is a reply to message #89188] Thu, 31 July 2014 04:03 Go to previous messageGo to next message
Matt[3] is currently offline  Matt[3]
Messages: 23
Registered: April 2011
Junior Member
Thanks, Fabien. The same thing happens:

IDL> py = pyimport('__main__')
ImportError: No module named numpy
% Dynamically loadable module failed to load: SLITHER.
% Execution halted at: $MAIN$



On Thursday, 31 July 2014 12:01:35 UTC+1, Fabien wrote:
> oops, I meant:
>
>
>
> IDL> py = pyimport('__main__')
>
> IDL> py->exec, 'import sys'
>
> IDL> py->exec, 'print(sys.version)'
>
> IDL> py->exec, 'import numpy'
>
>
>
> On 31.07.2014 13:00, Fabien wrote:
>
>> IDL> py = pyimport('__main__')
>
>> IDL> py->exec, 'print(sys.version)'
>
>> IDL> py->exec, 'import numpy'
Re: New free DLL for calling Python from IDL! [message #89190 is a reply to message #89189] Thu, 31 July 2014 04:10 Go to previous messageGo to next message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
On 31.07.2014 13:03, Matt wrote:
> IDL> py = pyimport('__main__')
> ImportError: No module named numpy

well this is strange because you're just importing python... Does
anaconda have a startup file for python, importing things like numpy,
iPython, etc automatically? That doesn't really explain why it doesn't
work, but would be a starting point maybe...
Re: New free DLL for calling Python from IDL! [message #89199 is a reply to message #89190] Fri, 01 August 2014 06:33 Go to previous messageGo to next message
Matt[3] is currently offline  Matt[3]
Messages: 23
Registered: April 2011
Junior Member
I've just tried setting this up on a newer system, which has the same basic setup, but potentially "cleaner" installs of IDL and Anaconda. I now get a different message:

IDL> random=pyimport("random")
% PYIMPORT: Error loading sharable executable.
Symbol: IDL_Load, File = /usr/local/exelis/idl83/bin/bin.linux.x86_64/Slither.so
libpython2.7.so.1.0: cannot open shared object file: No such file or directory
% Execution halted at: $MAIN$

Again, when I call Python using Spawn, I get sensible-looking outputs.

Could this perhaps be because there are effectively two Python builds on my machine? One is the system Python (2.6.6), and the other Anaconda, which I've installed in the /opt directory. IDL seems to see the right one when I use Spawn (2.7.8), but perhaps Slither sees the other?

Cheers,

Matt


On Thursday, 31 July 2014 12:10:39 UTC+1, Fabien wrote:
> On 31.07.2014 13:03, Matt wrote:
>
>> IDL> py = pyimport('__main__')
>
>> ImportError: No module named numpy
>
>
>
> well this is strange because you're just importing python... Does
>
> anaconda have a startup file for python, importing things like numpy,
>
> iPython, etc automatically? That doesn't really explain why it doesn't
>
> work, but would be a starting point maybe...
Re: New free DLL for calling Python from IDL! [message #89329 is a reply to message #89190] Mon, 18 August 2014 15:21 Go to previous message
Jason Ferrara is currently offline  Jason Ferrara
Messages: 17
Registered: February 2008
Junior Member
On Thursday, July 31, 2014 7:10:39 AM UTC-4, Fabien wrote:
> On 31.07.2014 13:03, Matt wrote:
>
>> IDL> py = pyimport('__main__')
>
>> ImportError: No module named numpy
>
>
>
> well this is strange because you're just importing python... Does
>
> anaconda have a startup file for python, importing things like numpy,
>
> iPython, etc automatically? That doesn't really explain why it doesn't
>
> work, but would be a starting point maybe...

Slither requires numpy. It's used for making IDL array visible to python. Slither attempts to import numpy after loading the python dll/so. So if you try to use Slither with a Python install that doesn't have numpy you'll get the error above.
  Switch to threaded view of this topic Create a new topic Submit Reply
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 09:19:10 PDT 2025

Total time taken to generate the page: 0.01148 seconds