Moving Plugin to Plugins (Disabled) on Syntax Error

This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
Forum rules
This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
User avatar
travisc
Posts: 346
Joined: Tue Sep 07, 2010 7:24 am
Location: Toronto, Canada
Contact:

Moving Plugin to Plugins (Disabled) on Syntax Error

Post by travisc »

I forget exactly when this behavior changed, but it used to be the case that if I tried to startup a plugin that had a syntax error, the plugin would immediately be moved to Plugins (Disabled). This is no longer the case with Indigo 5.0.4, and possibly 5.0.3?

It seems that if the syntax error is serious enough to immediately cause the plugin to fail, the plugin is not moved. Because I open the files with BBEdit from the (Disabled) folder, I can't quickly fix the error and save the file unless I go into the finder and manually move the folder first.

Not a huge deal, more of a nuisance than anything. And I don't recall this ever happening in earlier versions of Indigo 5.

Thanks!
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Moving Plugin to Plugins (Disabled) on Syntax Error

Post by matt (support) »

Hi Travis,

I don't recall it ever moving failed plugins (for any reason) to the Disabled folder. Now some plugins might disable themselves (which moves them to that folder), but I don't think Indigo has ever done that itself.

I'm not quite following the workflow/nuisance problem with editing the file. Can you explain in more detail? Note one thing I do is keep all of my plugins in a different folder (svn repo), then I put aliases of the plugins into the Enabled/Disabled folder. Indigo will just move the alias around, which might or might not help the workflow problem you are experiencing.
Image
User avatar
travisc
Posts: 346
Joined: Tue Sep 07, 2010 7:24 am
Location: Toronto, Canada
Contact:

Re: Moving Plugin to Plugins (Disabled) on Syntax Error

Post by travisc »

Hi Matt,

You're right, I didn't explain it properly. You already solved my problem with the alias idea but I'll better explain myself so you can understand the change in behavior I've noticed.

My usual workflow is:
1. Disable Plugin
2. Open plugin's files for editing from the "Plugins (Disabled)" folder.
3. Edit Code
4. Save changes to code
5. Enable Plugin to test code changes - Indigo moves Plugin folder to "Plugins"
6. Disable Plugin - Indigo moves Plugin folder back to "Plugins (Disabled)".
7. Repeat steps 3 thru 6 as I work on the plugin

The problem is if the plugin fails to initialize, like this for example ...
Plugin "DSC Alarm" connected
DSC Alarm Error Error in plugin execution InitializeMain:

Traceback (most recent call last):
File "plugin.py", line 12, in <module>
<type 'exceptions.SyntaxError'>: ('invalid syntax', ('/Library/Application Support/Perceptive Automation/Indigo 5/Plugins/DSC Alarm.indigoPlugin/Contents/Server Plugin/DSC.py', 8, 6, 'class\n'))

Error plugin "DSC Alarm 1.0.6" failed to initialize
Disabling plugin "DSC Alarm 1.0.6"
Stopping plugin "DSC Alarm 1.0.6" (pid 91479)
Plugin "DSC Alarm" disconnected
Indigo disconnects the plugin. I can't execute step 6 to disable the plugin because it seems to have already been disabled. If I pull down the plugin's menu it only says Enable. My plugin's folder is still located in the Plugins folder, it is never moved to Plugins (Disabled). So when I edit my code to resolve the error and then try to save it, BBEdit throws an error saying it can't find the file on the server, because of course it's still in the Plugins folder.

Unless I'm losing it, this behavior has changed recently. I used to able to select Disable no matter what the error was.

Using your idea with aliases is a more elegant solution.

Thanks
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Moving Plugin to Plugins (Disabled) on Syntax Error

Post by matt (support) »

I think what happened was I added some code that doesn't officially mark the plugin as enabled (internal state) until after it has successfully launched. If it doesn't launch correctly, then it isn't yet enabled (in this case "enabled" also includes up-and-running).

I don't believe it ever automatically Disabled failed plugins, but it probably did used to let you choose the Disable menu item (step 6 of yours) which would then move it out to the Disabled folder where BBEdit can find it.
Image
Locked

Return to “Extending Indigo with Plugins and Python”