sibson / vncdotool

A command line VNC client and python library
Other
454 stars 122 forks source link

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

Closed joachimmetz closed 1 year ago

joachimmetz commented 3 years ago

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

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
joachimmetz commented 3 years ago

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

self.buffer = b''

seems to prevent this issue from surfacing

joachimmetz commented 3 years ago

Some proposed changes https://github.com/sibson/vncdotool/pull/199 that seem to do the trick on my installation

pmhahn commented 1 year ago

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