[SOLVED]Python module via scripting host vs. embedded script

Posted on
Fri Feb 17, 2017 6:41 am
OjisanSeiuchi offline
User avatar
Posts: 20
Joined: May 06, 2016
Location: London, ON, CANADA

[SOLVED]Python module via scripting host vs. embedded script

Can someone describe to me why a confirmed, properly- installed module can be imported in the plugin host shell but not in an embedded script?

The module in question is `rrdtool` which are the Python bindings for rrdtool. I've properly installed the module in the Python 2.7 site-packages via:

Code: Select all
sudo easy_install rrdtool


and I can import the module in the plug-in host shell:

Code: Select all
import rrdtool


However, when I try to import the module via an embedded script, Indigo complains that the module isn't found.

What am I missing?

Posted on
Fri Feb 17, 2017 9:38 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python module via scripting host vs. embedded script

Have you restarted the Indigo server since you installed it? Also try the Plugins->Reload Libraries and Attachments menu item first.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Feb 17, 2017 12:29 pm
OjisanSeiuchi offline
User avatar
Posts: 20
Joined: May 06, 2016
Location: London, ON, CANADA

Re: Python module via scripting host vs. embedded script

Thanks Jay. Yes, I've both reloaded the libraries from the menu option and restarted the server. Neither seems to expose the module. I have no problem importing the module in the plugin host shell but not in an embedded script.

Posted on
Fri Feb 17, 2017 3:20 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python module via scripting host vs. embedded script

What is the exact path to the site-packages directory where it's installed?

Also, which version of Indigo are you using?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Feb 17, 2017 3:38 pm
OjisanSeiuchi offline
User avatar
Posts: 20
Joined: May 06, 2016
Location: London, ON, CANADA

Re: Python module via scripting host vs. embedded script

(Indigo 7.0.2, Python 2.7.10)
However...
It appears that this was related to a conflicting Python installation. At some point, I must have installed 2.7 via homebrew in the remote past that then was left in place after the system Python upgraded to 2.7. Uninstalling the second (non-system) Python 2.7 seems to have resolved the conflict. All is fine now. Thanks.

Posted on
Fri Feb 17, 2017 5:43 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python module via scripting host vs. embedded script

That's why I asked for the exact path - we've had a few users with that issue. Glad it's working now.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Aug 01, 2017 12:03 pm
dscottbuch offline
Posts: 90
Joined: Jan 19, 2004

Re: [SOLVED]Python module via scripting host vs. embedded sc

I'm having a similar problem. I'm running 10.12.6 and Indigo 7.0.3. I just removed all my MacPorts installed pythons and am back to using the included /usr/bin/python. I stopped and started the server. When I run Plugins->Open Scripting Shell I get a blank page in the terminal in which I can type but get no response. CTRL-D does nothing. I have to terminate the terminal to get out. Any help appreciated. I'm trying to move my AppleScript to Python.

Posted on
Tue Aug 01, 2017 1:29 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: [SOLVED]Python module via scripting host vs. embedded sc

Open a terminal window and type the following commands in order one at a time. Make sure that you've rebooted your Mac since you removed any other Python installs.

Copy/paste the results:

Code: Select all
which python
python -c "import sys; print(sys.version)"
/Library/Application\ Support/Perceptive\ Automation/Indigo\ 7/IndigoPluginHost.app/Contents/MacOS/IndigoPluginHost -e "import sys; print(sys.version)"


Be careful to select the entire last line - unfortunately, it gets cut off in the forum post but it will scroll.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Aug 02, 2017 11:15 am
dscottbuch offline
Posts: 90
Joined: Jan 19, 2004

Re: [SOLVED]Python module via scripting host vs. embedded sc

Two things.

1) My problem was actually that I'm running the server from launchd so the process is owned by root so I needed to run 'sudo ./IndigoPluginHost -i' - That worked.
2) Given that I then enabled the 'Global Property Manager' and the shell no longer worked. I got it back by dialing the GPM.

Thanks,

Posted on
Wed Aug 02, 2017 12:17 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: [SOLVED]Python module via scripting host vs. embedded sc

Your own launch document rather than the one Indigo manages?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 14 guests