RefactoringRope/JsonServer.py

changeset 347
b5048b5ff454
parent 346
877cac2e8d94
child 353
d38295fd97c2
equal deleted inserted replaced
346:877cac2e8d94 347:b5048b5ff454
4 # 4 #
5 5
6 """ 6 """
7 Module implementing the JSON based server base class. 7 Module implementing the JSON based server base class.
8 """ 8 """
9
10 from __future__ import unicode_literals
11 try:
12 str = unicode # __IGNORE_WARNING__ __IGNORE_EXCEPTION__
13 except NameError:
14 pass
15
16 9
17 import json 10 import json
18 11
19 from PyQt5.QtCore import ( 12 from PyQt5.QtCore import (
20 pyqtSlot, QProcess, QProcessEnvironment, QCoreApplication 13 pyqtSlot, QProcess, QProcessEnvironment, QCoreApplication
149 142
150 while connection and connection.canReadLine(): 143 while connection and connection.canReadLine():
151 data = connection.readLine() 144 data = connection.readLine()
152 jsonLine = bytes(data).decode("utf-8", 'backslashreplace') 145 jsonLine = bytes(data).decode("utf-8", 'backslashreplace')
153 146
154 ## print("JSON Server ({0}): {1}".format(self.__name, jsonLine)) 147 #- print("JSON Server ({0}): {1}".format(self.__name, jsonLine))
155 ## this is for debugging only 148 #- this is for debugging only
156 149
157 try: 150 try:
158 clientDict = json.loads(jsonLine.strip()) 151 clientDict = json.loads(jsonLine.strip())
159 except (TypeError, ValueError) as err: 152 except (TypeError, ValueError) as err:
160 E5MessageBox.critical( 153 E5MessageBox.critical(

eric ide

mercurial