unsupported operand type(s) line 835 in rfb.py with Python 3.6
Closed this issue ยท 4 comments
AlainB612 commented
Hi,
I've just installed the new version of vncdotool and get this error when trying to capture screen :
File "/usr/local/lib/python3.6/site-packages/vncdotool/rfb.py", line 835, in setKey
if bsrc & (1 << i):
builtins.TypeError: unsupported operand type(s) for &: 'str' and 'int'
The complete listing is at the end of this message.
04/17/2020 EDIT : I remove vncdotool 1.0.0 and rebuild 0.12 version : it works fine. I retry with 1.0.0 (from pip), I get the error.
Thanks for your help.
Alain
- VNC server and version : UltraVNC 1.2.4.0 on Windows Server 2016 64bits
- vncdotool version : vncdotool 1.0.0 (installed by PIP)
- Python version : 3.6
- OS : Linux CentOS 7 up to date
- steps to reproduce : command = vncdotool -p pwd -s 1.2.3.4::5900 -v capture capture.png 2>&1
# vncdotool -p pwd -s 1.2.3.4::5900 -v capture capture.png 2>&1
INFO:root:connecting to 1.2.3.4:5900
INFO:twisted:Starting factory <vncdotool.command.VNCDoCLIFactory object at 0x7f769c669898>
INFO:twisted:Using protocol version 3.800
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib64/python3.6/site-packages/twisted/python/log.py", line 103, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib64/python3.6/site-packages/twisted/python/log.py", line 86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib64/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib64/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/local/lib64/python3.6/site-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/usr/local/lib64/python3.6/site-packages/twisted/internet/tcp.py", line 243, in doRead
return self._dataReceived(data)
File "/usr/local/lib64/python3.6/site-packages/twisted/internet/tcp.py", line 249, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/usr/local/lib/python3.6/site-packages/vncdotool/rfb.py", line 685, in dataReceived
self._handler()
File "/usr/local/lib/python3.6/site-packages/vncdotool/rfb.py", line 694, in _handleExpected
self._expected_handler(block, *self._expected_args, **self._expected_kwargs)
File "/usr/local/lib/python3.6/site-packages/vncdotool/rfb.py", line 255, in _handleVNCAuth
self.vncRequestPassword()
File "/usr/local/lib/python3.6/site-packages/vncdotool/command.py", line 52, in vncRequestPassword
self.sendPassword(self.factory.password)
File "/usr/local/lib/python3.6/site-packages/vncdotool/rfb.py", line 261, in sendPassword
des = RFBDes(pw)
File "/usr/local/lib/python3.6/site-packages/vncdotool/pyDes.py", line 410, in __init__
self.setKey(key)
File "/usr/local/lib/python3.6/site-packages/vncdotool/rfb.py", line 835, in setKey
if bsrc & (1 << i):
builtins.TypeError: unsupported operand type(s) for &: 'str' and 'int'
CRITICAL:twisted:Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib64/python3.6/site-packages/twisted/python/log.py", line 103, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib64/python3.6/site-packages/twisted/python/log.py", line 86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib64/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib64/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/local/lib64/python3.6/site-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/usr/local/lib64/python3.6/site-packages/twisted/internet/tcp.py", line 243, in doRead
return self._dataReceived(data)
File "/usr/local/lib64/python3.6/site-packages/twisted/internet/tcp.py", line 249, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/usr/local/lib/python3.6/site-packages/vncdotool/rfb.py", line 685, in dataReceived
self._handler()
File "/usr/local/lib/python3.6/site-packages/vncdotool/rfb.py", line 694, in _handleExpected
self._expected_handler(block, *self._expected_args, **self._expected_kwargs)
File "/usr/local/lib/python3.6/site-packages/vncdotool/rfb.py", line 255, in _handleVNCAuth
self.vncRequestPassword()
File "/usr/local/lib/python3.6/site-packages/vncdotool/command.py", line 52, in vncRequestPassword
self.sendPassword(self.factory.password)
File "/usr/local/lib/python3.6/site-packages/vncdotool/rfb.py", line 261, in sendPassword
des = RFBDes(pw)
File "/usr/local/lib/python3.6/site-packages/vncdotool/pyDes.py", line 410, in __init__
self.setKey(key)
File "/usr/local/lib/python3.6/site-packages/vncdotool/rfb.py", line 835, in setKey
if bsrc & (1 << i):
builtins.TypeError: unsupported operand type(s) for &: 'str' and 'int'
CRITICAL:root:unsupported operand type(s) for &: 'str' and 'int'
INFO:twisted:Stopping factory <vncdotool.command.VNCDoCLIFactory object at 0x7f769c669898>
INFO:twisted:Main loop terminated.
guicho271828 commented
@sibson now you can close this issue
alex-romanov commented
Hello there. Is there an official workaround or something like that for this case? It's still valid, at least for v1.0.0 .
alex-romanov commented
Nevermind.
For folks who struggle with the same issue - just use a latest stable version instead of 1.0.0 from pip repo, in my case it's 0.12.0 which worked like a charm.
SebJansen commented
thanks, @alex-romanov!
worked like a charm with 0.13