Yosemite uses Python 2.6 for Scripts and Plugins

Posted on
Mon Aug 11, 2014 7:08 pm
mlfitzg offline
Posts: 2
Joined: Mar 04, 2012

Yosemite uses Python 2.6 for Scripts and Plugins

Maybe it's just me, but the scripting shell now shows Python 2.6.9 after upgrading to 6.0.14. (I also installed the Yosemite beta).

Is 2.6.9 the new/correct version of Python? (it seems to work for indigo methods but all my site-packages are in 2.5).

Posted on
Mon Aug 11, 2014 8:06 pm
jay (support) offline
Site Admin
User avatar
Posts: 16821
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python version with 6.0.14

We haven't moved to 2.6 so it's likely a Yosemite beta issue.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Oct 15, 2014 10:03 am
matt (support) offline
Site Admin
User avatar
Posts: 20569
Joined: Jan 27, 2003
Location: Texas

Yosemite uses Python 2.6 for Scripts and Plugins

It appears that when running Indigo under Yosemite python 2.6 will be used for plugins and script execution instead of python 2.5. This might cause some issues for scripts or plugins that are using python APIs that have different behavior under 2.6 than 2.5. We would have preferred that plugins/scripts continued to run under python 2.5 on Yosemite, but that is not something we can control.

This also means plugin developers running Yosemite need to be aware that the python APIs they are using may not be available for Indigo users not running Yosemite. Officially, Indigo 6 supports python 2.5 and we recommend plugin developers develop to python 2.5 for maximum compatibility for Indigo users.

Future major releases will likely change Indigo's officially supported python version, but because doing so requires a change to our Mac OS X minimum system requirement it is not something that can be changed in a minor release.

Image

Posted on
Wed Oct 15, 2014 10:19 am
kw123 offline
User avatar
Posts: 7695
Joined: May 12, 2013
Location: Dallas, TX

Re: Yosemite uses Python 2.6 for Scripts and Plugins

is there a good comparison chart to check for py 2.5 --> 2.6 changes .. i.e. things that would need to change in the plugins?

Posted on
Wed Oct 15, 2014 10:26 am
matt (support) offline
Site Admin
User avatar
Posts: 20569
Joined: Jan 27, 2003
Location: Texas

Re: Yosemite uses Python 2.6 for Scripts and Plugins

Not that I've seen (but I haven't done an exhaustive search). I believe for the most part python 2.5 scripts/plugins should run fine under python 2.6. That is, changes should be backwards compatible (unlike using py 2.6 specific APIs which obviously cannot work under py 2.5). That said, there might be subtle changes that cause problems. We tested all of our plugins and did not have to make any changes to the plugins themselves. Just be on the lookout for issues and realize they might be related to Yosemite / py 2.6.

Image

Posted on
Wed Oct 15, 2014 11:04 am
kw123 offline
User avatar
Posts: 7695
Joined: May 12, 2013
Location: Dallas, TX

Re: Yosemite uses Python 2.6 for Scripts and Plugins

2.6 + would be REALLY COOL !!

Posted on
Fri Oct 17, 2014 10:00 pm
Swancoat offline
Posts: 503
Joined: Nov 20, 2009
Location: Houston

Re: Yosemite uses Python 2.6 for Scripts and Plugins

I usually wait for a while to upgrade, by I had some persistent problems on my Mac that had me chomping at the bit, since I felt it was related to iCloud syncing and the changes to Yosemite might help (and they did - things running fine).

It DID of course, break two of my plugins. And it's the two I wrote (doh!). They're pretty similar serial parsing/writing plugins, but unfortunately, I opened them up and literally can't believe I ever wrote them. It looks totally foreign to me (yes, I struggled through Python for those plugins and only those plugins. NO other experience).

The break looks simple (like the say a variable is defined or something. Basically needs an integer of 'size 1'.

Anyone care to take a look here? I'm hoping this is just 'obvious' to someone who codes regularly and can suggest the minor edit (I hope) that is required.

From the Log:
Code: Select all
NuVo Grand Concerto Error       Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
  File "plugin.py", line 144, in runConcurrentThread
  File "/Library/Application Support/Perceptive Automation/Indigo 6/IndigoPluginHost.app/Contents/PlugIns/serial/urlhandler/protocol_socket.py", line 171, in write
  File "/Library/Application Support/Perceptive Automation/Indigo 6/IndigoPluginHost.app/Contents/PlugIns/serial/serialutil.py", line 78, in to_bytes
<type 'exceptions.TypeError'>: an integer or string of size 1 is required

  NuVo Grand Concerto Error       plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
 


Relevant Code (Lines 121-147): (Offending statement seems to be "send count=.....")
Code: Select all
   def runConcurrentThread(self):
      ## This is what runs as the plugin is simply 'running'.
      ## Basically, if a command comes in from the serial device, you read it, parse it and hand it off to
      ## whatever device/or variable needs to have its state updated.
      ## In the meantime, you have a queue set up which gets loaded with commands from devices which must be fed
      ## to the serial interface to be enacted.
      try:
         while True:
            if self.portEnabled:
               self.debugLog("Loop Running")
               sleeptime = 0.1
               fromgrandconcerto = 0
               fromgrandconcerto = self.conn.readline()
               if len(fromgrandconcerto) > 3:
                  sleeptime = 0.01
                  self.debugLog("Nuvo: " + fromgrandconcerto[:-2])  #removes last two characters (CR and LF)
                  self.parseToServer(fromgrandconcerto[:-2])
               if len(self.commQueue) > 0:
                  sleeptime = 0.01
                  # Sleep is set slow to keep processor use down, but putting 18 commands through with
                  # 0.1 sleeptime takes almost 2 seconds, so if there's commands in the queue, drop the sleeptime, and
                  # bang them through really fast. Then reset at beginning of loop.
                  self.debugLog(self.commQueue[0])
                  sendcount = self.conn.write("*" + self.commQueue.pop(0) + "\r")   
            self.sleep(sleeptime)
      except self.StopThread:
         pass   


Any ideas?

http://nerdhome.jimdo.com

Posted on
Fri Oct 17, 2014 10:03 pm
Swancoat offline
Posts: 503
Joined: Nov 20, 2009
Location: Houston

Re: Yosemite uses Python 2.6 for Scripts and Plugins

For whatever reason, it won't let me attach the full plugin here. Regardless, it's available on the blog in my signature.

On another note, I AM running a lot of plugins that are NOT crashing. For reference sake, those are:

Cynical SecuritySpy
Elk M1G Control
Growl
Smartphone Radar
SQL Logger
WeatherSnoop

http://nerdhome.jimdo.com

Posted on
Sat Oct 18, 2014 11:24 am
kw123 offline
User avatar
Posts: 7695
Joined: May 12, 2013
Location: Dallas, TX

Re: Yosemite uses Python 2.6 for Scripts and Plugins

you might want to try

sendcount = self.conn.write("*" + str(self.commQueue.pop(0)) + "\r")

if you don't have unicode characters

Karl

Posted on
Sat Oct 18, 2014 12:56 pm
Swancoat offline
Posts: 503
Joined: Nov 20, 2009
Location: Houston

Re: Yosemite uses Python 2.6 for Scripts and Plugins

Thanks - I'm out of town for the day, but will try it when I get back tomorrow and report back.


Sent from my iPad using Tapatalk HD

http://nerdhome.jimdo.com

Posted on
Sat Oct 18, 2014 5:09 pm
matt (support) offline
Site Admin
User avatar
Posts: 20569
Joined: Jan 27, 2003
Location: Texas

Re: Yosemite uses Python 2.6 for Scripts and Plugins

I think I have a global Indigo fix for this problem. If you are getting the "an integer or string of size 1 is required" error message then:

1) Stop the Indigo Server.

2) Download this replacement file for serialutil.py

3) RIght (or CONTROL key) click on the file /Library/Application Support/Perceptive Automation/Indigo 6/IndigoPluginHost.app and choose the Show Package Contents menu item.

4) Replace the following file Contents/PlugIns/serial/serialutil.py with the file you downloaded in step #2.

5) Restart the Indigo Server.

If this fixes the problem then we will add the change to the next release of 6 (6.0.18).

Image

Posted on
Sat Oct 18, 2014 9:26 pm
ZachBenz offline
Posts: 163
Joined: Feb 08, 2014

Re: Yosemite uses Python 2.6 for Scripts and Plugins

Matt,

That fixed the problem for me! Thanks!

Best regards,
-Zach

ZachBenz's Plugins: RingForIndigo

Posted on
Sun Oct 19, 2014 10:42 am
matt (support) offline
Site Admin
User avatar
Posts: 20569
Joined: Jan 27, 2003
Location: Texas

Re: Yosemite uses Python 2.6 for Scripts and Plugins

Indigo v6.0.18 is now available and includes this Yosemite compatibility fix.

Update: I believe the Nest plugin is currently not working because of the python change in Yosemite. If you setup is dependent on the Nest plugin, then do not upgrade to Yosemite yet.
Update #2: Perhaps Nest plugin is working after all. Follow its forum thread for details.

Image

Posted on
Sun Oct 19, 2014 1:11 pm
Swancoat offline
Posts: 503
Joined: Nov 20, 2009
Location: Houston

Re: Yosemite uses Python 2.6 for Scripts and Plugins

Well, by the time I got home, I didn't have enough time to implement any of those changes, as you had already released the update to Indigo.

Problems fixed!

Killer service! Thanks guys!

http://nerdhome.jimdo.com

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests