[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kate] addons/kate/pate/src/plugins: fixed python utils for python 3
From: Phil Schaf <flying-sheep () web ! de>
Date: 2013-05-31 17:39:13
Message-ID: 20130531173913.F02CBA6067 () git ! kde ! org
[Download RAW message or body]
Git commit 466fce48714ab660143f86e287def8dc4e395833 by Phil Schaf.
Committed on 31/05/2013 at 19:34.
Pushed by phils into branch 'master'.
fixed python utils for python 3
M +8 -0 addons/kate/pate/src/plugins/libkatepate/errors.py
M +3 -3 addons/kate/pate/src/plugins/python_utils/python_utils.py
http://commits.kde.org/kate/466fce48714ab660143f86e287def8dc4e395833
diff --git a/addons/kate/pate/src/plugins/libkatepate/errors.py \
b/addons/kate/pate/src/plugins/libkatepate/errors.py index 17a2786..dd0bbbf 100644
--- a/addons/kate/pate/src/plugins/libkatepate/errors.py
+++ b/addons/kate/pate/src/plugins/libkatepate/errors.py
@@ -119,6 +119,14 @@ def showOk(message="Ok", time=3, icon='dialog-ok'):
kate.gui.popup(message, time, icon='dialog-ok', minTextWidth=200)
+def error_message(e):
+ """Python 3 has another attribute name for the message"""
+ try:
+ return e.msg # py3
+ except AttributeError:
+ return e.message # py2
+
+
def _compress_key(line, column):
doc = kate.activeDocument()
cipher = len('%s' % doc.lines())
diff --git a/addons/kate/pate/src/plugins/python_utils/python_utils.py \
b/addons/kate/pate/src/plugins/python_utils/python_utils.py index 90098aa..0e725a3 \
100644
--- a/addons/kate/pate/src/plugins/python_utils/python_utils.py
+++ b/addons/kate/pate/src/plugins/python_utils/python_utils.py
@@ -25,7 +25,7 @@ import os
from PyQt4 import uic
from PyQt4.QtGui import QWidget
-from libkatepate.errors import needs_packages
+from libkatepate.errors import needs_packages, error_message
from python_snippets import *
from python_checkers.parse_checker import *
@@ -48,13 +48,13 @@ try:
needs_packages({"pep8": "1.4.2"})
from python_checkers.pep8_checker import *
except ImportError as e:
- msg_error += e.message + "\n"
+ msg_error += error_message(e) + "\n"
finally:
try:
needs_packages({"pyflakes": "0.6.1"})
from python_checkers.pyflakes_checker import *
except ImportError as e:
- msg_error += e.message
+ msg_error += error_message(e)
raise ImportError(msg_error)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic