mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-25 14:36:01 +03:00
Use encode()/decode() with Python 3 only
This commit is contained in:
parent
23d64dd3ac
commit
56ea525499
1 changed files with 4 additions and 3 deletions
|
@ -63,7 +63,7 @@ class SocketConnect(GObject.GObject):
|
||||||
self._watch_id = 0
|
self._watch_id = 0
|
||||||
self._sock = None
|
self._sock = None
|
||||||
self._listeners = [self._update_registered_paths, self._get_version]
|
self._listeners = [self._update_registered_paths, self._get_version]
|
||||||
self._remainder = ''.encode()
|
self._remainder = ''.encode() if python3 else ''
|
||||||
self.protocolVersion = '1.0'
|
self.protocolVersion = '1.0'
|
||||||
self.nautilusVFSFile_table = {} # not needed in this object actually but shared
|
self.nautilusVFSFile_table = {} # not needed in this object actually but shared
|
||||||
# all over the other objects.
|
# all over the other objects.
|
||||||
|
@ -82,7 +82,7 @@ class SocketConnect(GObject.GObject):
|
||||||
# print("Server command: " + cmd)
|
# print("Server command: " + cmd)
|
||||||
if self.connected:
|
if self.connected:
|
||||||
try:
|
try:
|
||||||
self._sock.send(cmd.encode())
|
self._sock.send(cmd.encode() if python3 else cmd)
|
||||||
except:
|
except:
|
||||||
print("Sending failed.")
|
print("Sending failed.")
|
||||||
self.reconnect()
|
self.reconnect()
|
||||||
|
@ -134,7 +134,8 @@ class SocketConnect(GObject.GObject):
|
||||||
return []
|
return []
|
||||||
data = self._remainder[:end]
|
data = self._remainder[:end]
|
||||||
self._remainder = self._remainder[end+1:]
|
self._remainder = self._remainder[end+1:]
|
||||||
return data.decode().split('\n')
|
data = data.decode() if python3 else data
|
||||||
|
return data.split('\n')
|
||||||
|
|
||||||
# Notify is the raw answer from the socket
|
# Notify is the raw answer from the socket
|
||||||
def _handle_notify(self, source, condition):
|
def _handle_notify(self, source, condition):
|
||||||
|
|
Loading…
Reference in a new issue