sibson/vncdotool

vnclog Unhandled Error: builtins.TypeError: can only concatenate str (not "bytes") to str

joachimmetz opened this issue · 3 comments

Thx for the making this interesting tool available. I was just playing around with it, so nothing urgent.

Description:

vnclog raises Unhandled Error: builtins.TypeError: can only concatenate str (not "bytes") to str see traceback below

Requested information

Have you included the following information?

  • VNC server and version
  • vncdotool version
  • steps to reproduce
  • traceback

VNC server and version

QEMU built-in VNC server, listening on 127.0.0.1:5901
note that a SPICE sever is listening on 127.0.0.1:5900

vncdotool version

1.0.0

steps to reproduce

  1. Run vnclog --forever --listen 6000 /tmp
  2. connect remote-viewer to vnc://127.0.0.1:6000

Traceback

Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/twisted/python/log.py", line 101, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/usr/lib/python3.9/site-packages/twisted/python/log.py", line 85, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/lib/python3.9/site-packages/twisted/python/context.py", line 118, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python3.9/site-packages/twisted/python/context.py", line 83, in callWithContext
    return func(*args, **kw)
--- <exception caught here> ---
  File "/usr/lib/python3.9/site-packages/twisted/internet/posixbase.py", line 687, in _doReadOrWrite
    why = selectable.doRead()
  File "/usr/lib/python3.9/site-packages/twisted/internet/tcp.py", line 246, in doRead
    return self._dataReceived(data)
  File "/usr/lib/python3.9/site-packages/twisted/internet/tcp.py", line 251, in _dataReceived
    rval = self.protocol.dataReceived(data)
  File "vncdotool-1.0.0/vncdotool/loggingproxy.py", line 202, in dataReceived
    RFBServer.dataReceived(self, data)
  File "vncdotool-1.0.0/vncdotool/loggingproxy.py", line 40, in dataReceived
    self.buffer += data
builtins.TypeError: can only concatenate str (not "bytes") to str

CRITICAL:twisted:Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/twisted/python/log.py", line 101, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/usr/lib/python3.9/site-packages/twisted/python/log.py", line 85, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/lib/python3.9/site-packages/twisted/python/context.py", line 118, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python3.9/site-packages/twisted/python/context.py", line 83, in callWithContext
    return func(*args, **kw)
--- <exception caught here> ---
  File "/usr/lib/python3.9/site-packages/twisted/internet/posixbase.py", line 687, in _doReadOrWrite
    why = selectable.doRead()
  File "/usr/lib/python3.9/site-packages/twisted/internet/tcp.py", line 246, in doRead
    return self._dataReceived(data)
  File "/usr/lib/python3.9/site-packages/twisted/internet/tcp.py", line 251, in _dataReceived
    rval = self.protocol.dataReceived(data)
  File "vncdotool-1.0.0/vncdotool/loggingproxy.py", line 202, in dataReceived
    RFBServer.dataReceived(self, data)
  File "vncdotool-1.0.0/vncdotool/loggingproxy.py", line 40, in dataReceived
    self.buffer += data
builtins.TypeError: can only concatenate str (not "bytes") to str

changing https://github.com/sibson/vncdotool/blob/main/vncdotool/loggingproxy.py#L34 to:

self.buffer = b''

seems to prevent this issue from surfacing

Some proposed changes #199 that seem to do the trick on my installation

This is already fixed in main, but sadly there is still no new release on pypi, which is another issue #203