diff --git a/src/OGAgentUser.py b/src/OGAgentUser.py index 4ec09ce..0a7c9ee 100644 --- a/src/OGAgentUser.py +++ b/src/OGAgentUser.py @@ -32,14 +32,13 @@ from __future__ import unicode_literals import sys -from PyQt4 import QtGui -from PyQt4 import QtCore - import time import signal import json import six import atexit +from PyQt4 import QtGui +from PyQt4 import QtCore from opengnsys import ipc from opengnsys import utils @@ -53,6 +52,11 @@ from opengnsys import VERSION from opengnsys.config import readConfig from opengnsys.loader import loadModules +# Set default characters encoding to UTF-8 +reload(sys) +if hasattr(sys, 'setdefaultencoding'): + sys.setdefaultencoding('utf-8') + trayIcon = None def sigAtExit(): @@ -309,7 +313,7 @@ class OGASystemTray(QtGui.QSystemTrayIcon): self.cleanup() self.app.quit() - def closeEvent(self,event): + def closeEvent(self, event): logger.debug("Exec closeEvent") event.accept() self.quit() diff --git a/src/opengnsys/windows/operations.py b/src/opengnsys/windows/operations.py index 4ff88c3..32ad817 100644 --- a/src/opengnsys/windows/operations.py +++ b/src/opengnsys/windows/operations.py @@ -237,5 +237,5 @@ def showPopup(title, message): ''' Displays a message box on user's session (during 1 min). ''' - return subprocess.call('mshta "javascript:var sh=new ActiveXObject(\'WScript.Shell\'); sh.Popup( \'{}\', 60, \'{}\', 64); close()"'.format(message, title), shell=True) + return subprocess.call('mshta "javascript:var sh=new ActiveXObject(\'WScript.Shell\'); sh.Popup( \'{}\', 60, \'{}\', 64); close()"'.format(message.encode('unicode_escape'), title.encode('unicode_escape')), shell=True) diff --git a/src/setup.py b/src/setup.py index c55b4aa..f80bf33 100644 --- a/src/setup.py +++ b/src/setup.py @@ -121,7 +121,7 @@ setup( 'bundle_files': 3, 'compressed': True, 'optimize': 2, - 'includes': ['sip', 'PyQt4', 'win32com.shell', 'requests'] + HIDDEN_BY_SIX, + 'includes': ['sip', 'PyQt4', 'win32com.shell', 'requests', 'encodings', 'encodings.utf_8'] + HIDDEN_BY_SIX, 'excludes': ['doctest', 'unittest'], 'dll_excludes': ['msvcp90.dll'], 'dist_dir': '..\\bin',