Re: python bridge setup - IDL8.6.1 Mac OS X Sierra [message #94697 is a reply to message #94687] |
Fri, 25 August 2017 07:30   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Saturday, August 19, 2017 at 4:11:59 AM UTC-6, wallabadah wrote:
> Thanks for the quick response Chris, it's now much closer to working as it should, but not quite...
>
> Running IDL code from python works as expected, using the following code from IDL Help (albeit with an error
>
>>>> from idlpy import *
>>>> import numpy.random as ran
>>>> arr = ran.rand(100)
>>>> p = IDL.plot(arr, title='My Plot')
> (a plot is displayed)
> Warning: Cannot convert string " -adobe-helvetica-medium-r-normal-*-*-120-75-75-p-*-iso8859-1 " to type FontStruct
>
> Running python within IDL works as expected, using the following code form IDL help:
>
>>>>
> import matplotlib.pyplot as plt
> import numpy.random as ran
> arr = ran.rand(100)
> p = plt.plot(arr)
> plt.show()
> (a plot is displayed)
>
> But running python code at the IDL command line doesn't work:
>
> ran = Python.Import('numpy.random')
> arr = ran.rand(100) ; call "rand" method
> plt = Python.Import('matplotlib.pyplot')
> p = plt.plot(arr) ; call "plot", pass an array
> void = plt.show(block=0) ; pass keyword
> (no plot is shown, no error messages)
>
> If you can provide any advice Chris I'd appreciated it, and I'm sure others on the list would appreciate it too.
>
> On a related note, is there any documentation on how using one of the IDL bridges works with distributing software? If one was to develop an IDL application that used (for example) some python code via a bridge, and tried to distribute it using make_rt and the IDL virtual machine... I guess the end user would have to go through the process of setting paths and installing python just as I have been doing in the last few days? Seems a little tricky for the non-specialist... Are there plans to streamline the process?
>
> thanks,
>
> Will
Hi Will,
Is the IDL->Python bridge working for non-graphics? In other words, if you just do:
IDL> >>>2+2
Does it print out the answer?
If so, I'd suggest it's just a problem with either the Qt within Anaconda, or running Qt from within Python within IDL. I can't get the plot to show up on my Windows box either (I get a weird Qt error), although everything else works fine.
Regarding your "distributing software" question, we don't have any documentation or pre-canned solution for making this work. That's one of the unfortunate side effects of working with an open-source 3rd party package like Python - you sort of get what you pay for. Anyway, it's a great suggestion and we can think about adding better support in the future.
Cheers,
Chris
|
|
|