Skip to content

Commit

Permalink
the usual annoying py3k fixes, this time for the new sound / subproce…
Browse files Browse the repository at this point in the history
…ss wrapper code

git-svn-id: https://xpra.org/svn/Xpra/trunk@8864 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Mar 30, 2015
1 parent 278fbd7 commit a665b46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/xpra/net/subprocess_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from xpra.net.bytestreams import TwoFileConnection
from xpra.net.protocol import Protocol
from xpra.os_util import Queue, setbinarymode, SIGNAMES
from xpra.os_util import Queue, setbinarymode, SIGNAMES, bytestostr
from xpra.log import Logger
log = Logger("util")

Expand Down Expand Up @@ -105,13 +105,13 @@ def make_protocol(self):
#figure out where we read from and write to:
if self.input_filename=="-":
#disable stdin buffering:
self._input = os.fdopen(sys.stdin.fileno(), 'r', 0)
self._input = os.fdopen(sys.stdin.fileno(), 'rb', 0)
setbinarymode(self._input.fileno())
else:
self._input = open(self.input_filename, 'rb')
if self.output_filename=="-":
#disable stdout buffering:
self._output = os.fdopen(sys.stdout.fileno(), 'w', 0)
self._output = os.fdopen(sys.stdout.fileno(), 'wb', 0)
setbinarymode(self._output.fileno())
else:
self._output = open(self.output_filename, 'wb')
Expand Down Expand Up @@ -165,7 +165,7 @@ def get_packet(self):
return (item, None, None, self.send_queue.qsize()>0)

def process_packet(self, proto, packet):
command = packet[0]
command = bytestostr(packet[0])
if command==Protocol.CONNECTION_LOST:
log("connection-lost: %s, calling stop", packet[1:])
self.stop()
Expand Down Expand Up @@ -284,7 +284,7 @@ def send(self, *packet_data):
def process_packet(self, proto, packet):
if DEBUG_WRAPPER:
log("process_packet(%s, %s)", proto, [str(x)[:32] for x in packet])
command = packet[0]
command = bytestostr(packet[0])
callbacks = self.signal_callbacks.get(command)
log("process_packet callbacks(%s)=%s", command, callbacks)
if callbacks:
Expand Down
5 changes: 3 additions & 2 deletions src/xpra/sound/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from xpra.net.subprocess_wrapper import subprocess_caller, subprocess_callee, gobject
from xpra.platform.paths import get_sound_executable
from xpra.util import AdHocStruct
from xpra.os_util import bytestostr
from xpra.log import Logger
log = Logger("sound")

Expand Down Expand Up @@ -157,9 +158,9 @@ def exec_kwargs(self):
#on win32, the environment can end up containing unicode, and subprocess chokes on it
for k,v in env.items():
try:
env[k] = v.encode("utf8")
env[k] = bytestostr(v.encode("utf8"))
except:
env[k] = str(v)
env[k] = bytestostr(v)
return kwargs


Expand Down

0 comments on commit a665b46

Please sign in to comment.