diff --git a/bin/g15ladi b/bin/g15ladi index 030282a..ea1c2bc 100755 --- a/bin/g15ladi +++ b/bin/g15ladi @@ -194,8 +194,8 @@ class jackctl_g15: status_line += " started in non-realtime mode" else: status_line += " stopped" - except Exception, e: - print repr(e) + except Exception as e: + print(repr(e)) status_line = "JACK cannot be connected" if self.jack: self.g15.clear(False) diff --git a/bin/ladiconf b/bin/ladiconf index 32b6082..3af4e0f 100755 --- a/bin/ladiconf +++ b/bin/ladiconf @@ -41,16 +41,16 @@ def check_ladish(): try: proxy = laditools.ladish_proxy() except: - print "ladish proxy creation failed" + print("ladish proxy creation failed") return if not proxy.is_available(): - print "ladish is not available" + print("ladish is not available") return if proxy.studio_is_loaded(): if not proxy.studio_is_started(): - print "ladish studio is loaded and not started" + print("ladish studio is loaded and not started") return else: msg = "JACK can only be configured with a stopped studio. Please stop your studio first." @@ -240,7 +240,7 @@ class cell_renderer_param(gtk.GenericCellRenderer): else: self.set_property('mode', gtk.CELL_RENDERER_MODE_EDITABLE) else: - print pspec.name + print(pspec.name) setattr(self, pspec.name, value) def do_get_property(self, pspec): @@ -335,7 +335,7 @@ class cell_renderer_param(gtk.GenericCellRenderer): if typechar == 'u' or typechar == 'i': try: value = int(value_str) - except ValueError, e: + except ValueError as e: # Hide the widget (because it may display something else than what user typed in) widget.hide() # Display the error diff --git a/bin/ladilog b/bin/ladilog index 9b72e35..6d8cef9 100755 --- a/bin/ladilog +++ b/bin/ladilog @@ -43,7 +43,7 @@ try: pygtk.require ('2.0') import gtk import vte -except Exception, e: +except Exception as e: error = gtk.MessageDialog (None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, _("You need to get you dependencies right before you run this program. Ask your package maintainer why this is happening to you\n%s") % repr(e)) error.run () exit (1) @@ -113,9 +113,9 @@ class ladilog(object): # skip logfiles that dont exist if not os.access(log['logfile_path'], os.R_OK): self.log_files.remove(log) - print _("Skipping '%s' because it does not exist") % log['logfile_path'] + print(_("Skipping '%s' because it does not exist") % log['logfile_path']) else: - print _("Watching '%s'") % log['logfile_path'] + print(_("Watching '%s'") % log['logfile_path']) max_lines_text = self.param_dict['max_lines'] self.max_lines = int (max_lines_text) @@ -149,9 +149,9 @@ class ladilog(object): log["term"].feed(line) except ValueError: - print _("You called Popen with invalid arguments... dumbass") + print(_("You called Popen with invalid arguments... dumbass")) except: - print _("Unexpected error:"), sys.exc_info ()[0] + print(_("Unexpected error:"), sys.exc_info ()[0]) for log in self.log_files: self.logview_notebook.append_page (log["term"]) @@ -191,7 +191,7 @@ class ladilog(object): try: ladilog().run() -except Exception, e: +except Exception as e: error = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, _("Unexpected error\n\n") + repr(e)) error.run() exit(1) diff --git a/bin/laditray b/bin/laditray index 2c6df24..abf6203 100755 --- a/bin/laditray +++ b/bin/laditray @@ -107,7 +107,7 @@ class laditray (gtk.StatusIcon, laditools.manager): self.set_tooltip_safe ("JACK is stopped") self.set_icon ("stopped") self.clear_diagnose_text() - except Exception, e: + except Exception as e: self.set_tooltip_safe ("JACK is sick") self.set_diagnose_text(repr(e)) self.set_icon ("stopped") diff --git a/bin/wmladi b/bin/wmladi index aa750ff..fd48ec3 100755 --- a/bin/wmladi +++ b/bin/wmladi @@ -144,10 +144,10 @@ class wmladi (wmoo.Application, laditools.manager): self.clear_line(5) self.started = False self.clear_diagnose_text() - except Exception, e: + except Exception as e: self.set_diagnose_text(repr(e)) if debug: - print repr (e) + print(repr (e)) self.set_line(0, "JACK") self.set_line(1, "is sick") self.clear_line(2) diff --git a/laditools/TreeViewTooltips.py b/laditools/TreeViewTooltips.py index 1112d3e..77963a6 100644 --- a/laditools/TreeViewTooltips.py +++ b/laditools/TreeViewTooltips.py @@ -292,7 +292,7 @@ class TreeViewTooltips: def get_tooltip(self, view, column, path): 'See the module doc string for a description of this method' - raise NotImplemented, 'Subclass must implement get_tooltip()' + raise NotImplemented('Subclass must implement get_tooltip()') if __name__ == '__main__': diff --git a/laditools/__init__.py b/laditools/__init__.py index 5ec64c5..7ca3969 100644 --- a/laditools/__init__.py +++ b/laditools/__init__.py @@ -15,12 +15,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from jack_controller import jack_controller -from jack_configure import jack_configure -from ladimenu import manager, find_data_file -from a2j_controller import a2j_controller -from a2j_menu import a2j_menu -from ladish_controller import ladish_proxy +from .jack_controller import jack_controller +from .jack_configure import jack_configure +from .ladimenu import manager, find_data_file +from .a2j_controller import a2j_controller +from .a2j_menu import a2j_menu +from .ladish_controller import ladish_proxy # from error import error -from config import config -from TreeViewTooltips import TreeViewTooltips +from .config import config +from .TreeViewTooltips import TreeViewTooltips diff --git a/laditools/a2j_controller.py b/laditools/a2j_controller.py index 512a0c6..9d7ca5a 100644 --- a/laditools/a2j_controller.py +++ b/laditools/a2j_controller.py @@ -31,7 +31,7 @@ class a2j_controller: try: self.iface.is_started() return True - except Exception, e: + except Exception as e: #print repr(e) return False diff --git a/laditools/config.py b/laditools/config.py index ef858bb..fc0c7b6 100644 --- a/laditools/config.py +++ b/laditools/config.py @@ -25,7 +25,7 @@ from xdg import BaseDirectory as basedir config_dir = path.join(basedir.xdg_config_home, 'laditools') config_filename = path.join(config_dir, 'laditools.conf') if not exists (config_dir): - mkdir (config_dir, 0755) + mkdir (config_dir, 0o755) # Note to users of the config class. Only applications should create an instance # of the config object. The ladimenu is *NOT* an application... diff --git a/laditools/jack_configure.py b/laditools/jack_configure.py index 2c2ab51..53789ea 100644 --- a/laditools/jack_configure.py +++ b/laditools/jack_configure.py @@ -42,7 +42,7 @@ class jack_configure: # self.bus.add_signal_receiver (self.name_owner_changed, dbus_interface = controller_interface_name, signal_name = "NameOwnerChanged") def name_owner_changed (name = None, old_owner = None, new_owner = None): - print "Name changed : %r" % name + print("Name changed : %r" % name) def get_selected_driver (self): isset, default, value = self.iface.GetParameterValue (['engine', 'driver']) diff --git a/laditools/ladimenu.py b/laditools/ladimenu.py index 6938b19..4912050 100644 --- a/laditools/ladimenu.py +++ b/laditools/ladimenu.py @@ -23,11 +23,11 @@ pygtk.require('2.0') import gtk import gobject import subprocess -from config import config -from jack_configure import jack_configure -from jack_controller import jack_controller -from a2j_controller import a2j_controller -from ladish_controller import ladish_proxy +from .config import config +from .jack_configure import jack_configure +from .jack_controller import jack_controller +from .a2j_controller import a2j_controller +from .ladish_controller import ladish_proxy # Default launcher menu : menu_default = [{"Configure": "ladiconf"}, @@ -239,7 +239,7 @@ class manager: def on_menu_command(self, widget, function): try: function() - except Exception, e: + except Exception as e: error = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, "Error executing " + repr(function) + "Unexpected error\n\n" + repr(e)) error.run() error.destroy() @@ -259,8 +259,8 @@ class manager: item.show() menu.append(item) item.connect("button-release-event", function, studio) # "activate" is not used because of focus bug in pygtk - except Exception, e: - print e + except Exception as e: + print(e) self.menu_clear(menu) item = gtk.MenuItem("Error obtaining studio list") item.set_sensitive(False) @@ -284,8 +284,8 @@ class manager: # Add the laucher entries at the beginning of the menu for items in self.menu_array: - menu_label = items.keys()[0] + "..." - path = items.values()[0] + menu_label = list(items.keys())[0] + "..." + path = list(items.values())[0] menu_items.append((gtk.ImageMenuItem(menu_label), self.on_menu_launcher, path)) menu = gtk.Menu() diff --git a/laditools/ladish_controller.py b/laditools/ladish_controller.py index 14b34c6..99971ed 100644 --- a/laditools/ladish_controller.py +++ b/laditools/ladish_controller.py @@ -36,7 +36,7 @@ class ladish_proxy: try: self.control_iface.IsStudioLoaded() return True - except Exception, e: + except Exception as e: #print repr(e) return False