Here the use-case:
when you disable a plugin and would like to execute an external program (e.g. python) that is included in your plugin package as the last step
When you disable a plugin INDIGO immediately moves the plugin to the /Plugin (Disabled)/ directory. This happens before the exit exception gets handled.
so if you would like to start an e.g. cleanup up job at the point of exit you must choose the path to the /Plugin (Disabled)/ directory:
- Code: Select all
try:
while True:
your code here
except Exception, e:
indigo.server.log( u"in Line '%s' has error='%s'" % (sys.exc_traceback.tb_lineno, e) )
subprocess.Popen("/usr/bin/python2.7 '/Library/Application Support/Perceptive Automation/Indigo 6/Plugins (Disabled)/yourPluginName.indigoPlugin/Contents/Server Plugin/progamToLauch.py'", shell = True)
- Code: Select all
subprocess.Popen("/usr/bin/python2.7 '/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/yourPluginName.indigoPlugin/Contents/Server Plugin/progamToLauch.py'", shell = True)
This is not true when you "restart" a plugin
Took me some time to figure this out.
Karl