X-Git-Url: https://git.camperquake.de/gitweb.cgi?p=time-slider.git;a=blobdiff_plain;f=usr%2Fshare%2Ftime-slider%2Flib%2Fplugin%2Fplugin.py;h=e509b19d3c9e7f139e223add2974531ad622083b;hp=7d1e3d1cf434c7f315ada03e0e7638fbdd6a9e43;hb=75feb72a4aa1bf0940b4b2eaddd68c781cdf50ee;hpb=1ad3b546afd04dedd97020e33bd153531b4cdee2 diff --git a/usr/share/time-slider/lib/plugin/plugin.py b/usr/share/time-slider/lib/plugin/plugin.py index 7d1e3d1..e509b19 100644 --- a/usr/share/time-slider/lib/plugin/plugin.py +++ b/usr/share/time-slider/lib/plugin/plugin.py @@ -23,7 +23,7 @@ import os import sys import subprocess -import pluginsmf +from . import pluginsmf from time_slider import smf, autosnapsmf, util @@ -46,15 +46,15 @@ class Plugin(Exception): command = self.smfInst.get_trigger_command() try: statinfo = os.stat(command) - other_x = (statinfo.st_mode & 01) + other_x = (statinfo.st_mode & 0o1) if other_x == 0: - raise RuntimeError, 'Plugin: %s:\nConfigured trigger command is not ' \ + raise RuntimeError('Plugin: %s:\nConfigured trigger command is not ' \ 'executable:\n%s' \ - % (self.smfInst.instanceName, command) + % (self.smfInst.instanceName, command)) except OSError: - raise RuntimeError, 'Plugin: %s:\nCan not access the configured ' \ + raise RuntimeError('Plugin: %s:\nCan not access the configured ' \ 'plugin/trigger_command:\n%s' \ - % (self.smfInst.instanceName, command) + % (self.smfInst.instanceName, command)) def execute(self, schedule, label): @@ -96,9 +96,9 @@ class Plugin(Exception): stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) - except OSError, message: - raise RuntimeError, "%s subprocess error:\n %s" % \ - (cmd, str(message)) + except OSError as message: + raise RuntimeError("%s subprocess error:\n %s" % \ + (cmd, str(message))) self._proc = None def is_running(self): @@ -142,8 +142,8 @@ class PluginManager(): err = p.wait() if err != 0: self._refreshLock.release() - raise RuntimeError, '%s failed with exit code %d\n%s' % \ - (str(cmd), err, errdata) + raise RuntimeError('%s failed with exit code %d\n%s' % \ + (str(cmd), err, errdata)) for line in outdata.rstrip().split('\n'): line = line.rstrip().split() state = line[0] @@ -158,7 +158,7 @@ class PluginManager(): try: plugin = Plugin(fmri, self.verbose) self.plugins.append(plugin) - except RuntimeError, message: + except RuntimeError as message: sys.stderr.write("Ignoring misconfigured plugin: %s\n" \ % (fmri)) sys.stderr.write("Reason:\n%s\n" % (message))