TortoiseHgOverlayServer not starting (Python 3 bytes / str issues)
The TortoiseHgOverlayServer.exe doesn't start at all.
Running TortoiseHgOverlayServer.py from the repository it throws the following exception:
>py TortoiseHgOverlayServer.py
Traceback (most recent call last):
File "D:\temp\thg-branch-stable\TortoiseHgOverlayServer.py", line 574, in <module>
main()
File "D:\temp\thg-branch-stable\TortoiseHgOverlayServer.py", line 566, in main
logger.setfile(logfilename)
File "D:\temp\thg-branch-stable\TortoiseHgOverlayServer.py", line 78, in setfile
self.msg('%s, Version %s' % (APP_TITLE, version.version()))
File "D:\temp\thg-branch-stable\TortoiseHgOverlayServer.py", line 85, in msg
f.write(ts + msg + '\n')
TypeError: a bytes-like object is required, not 'str'
This is most likely a regression from Python 3 migration.
One possible solution would be f.write((ts + msg + '\n').encode('ascii'))
in the relevant line.
Then a second exception is raised:
Traceback (most recent call last):
File "D:\temp\thg-branch-stable\TortoiseHgOverlayServer.py", line 574, in <module>
main()
File "D:\temp\thg-branch-stable\TortoiseHgOverlayServer.py", line 570, in main
w=MainWindow()
File "D:\temp\thg-branch-stable\TortoiseHgOverlayServer.py", line 157, in __init__
self.hwnd = CreateWindow( classAtom, APP_TITLE, style,
TypeError: Objects of type 'bytes' can not be converted to Unicode.
Here a solution could be APP_TITLE = _('TortoiseHg Overlay Icon Server').decode('ascii')
Number 3
Traceback (most recent call last):
File "C:\Users\schlaich\AppData\Local\Programs\Python\Python39-32\lib\threading.py", line 973, in _bootstrap_inner
self.run()
File "D:\temp\thg-branch-stable\TortoiseHgOverlayServer.py", line 434, in run
s = req.split('|')
TypeError: a bytes-like object is required, not 'str'
Solution s = req.decode('ascii').split('|')
Number 4
Traceback (most recent call last):
File "C:\Users\schlaich\AppData\Local\Programs\Python\Python39-32\lib\threading.py", line 973, in _bootstrap_inner
self.run()
File "D:\temp\thg-branch-stable\TortoiseHgOverlayServer.py", line 439, in run
dispatch(req, cmd, args, self.hwnd)
File "D:\temp\thg-branch-stable\TortoiseHgOverlayServer.py", line 418, in dispatch
update(args, hwnd)
File "D:\temp\thg-branch-stable\TortoiseHgOverlayServer.py", line 379, in update
s = req.split('|')
TypeError: a bytes-like object is required, not 'str'
Solution s = req.decode('ascii').split('|')
Number 5
Traceback (most recent call last):
File "C:\Users\schlaich\AppData\Local\Programs\Python\Python39-32\lib\threading.py", line 973, in _bootstrap_inner
self.run()
File "D:\temp\thg-branch-stable\TortoiseHgOverlayServer.py", line 439, in run
dispatch(req, cmd, args, self.hwnd)
File "D:\temp\thg-branch-stable\TortoiseHgOverlayServer.py", line 418, in dispatch
update(args, hwnd)
File "D:\temp\thg-branch-stable\TortoiseHgOverlayServer.py", line 392, in update
update_batch(batch)
File "D:\temp\thg-branch-stable\TortoiseHgOverlayServer.py", line 299, in update_batch
if shlib.update_thgstatus(_ui, r, wait=False):
File "D:\temp\thg-branch-stable\tortoisehg\util\shlib.py", line 94, in update_thgstatus
repo = hg.repository(ui, root) # a fresh repo object is needed
File "D:\temp\venv-hg\lib\site-packages\mercurial\hg.py", line 217, in repository
peer = _peerorrepo(
File "D:\temp\venv-hg\lib\site-packages\mercurial\hg.py", line 184, in _peerorrepo
obj = _peerlookup(path).instance(
File "D:\temp\venv-hg\lib\site-packages\mercurial\hg.py", line 144, in _peerlookup
u = urlutil.url(path)
File "D:\temp\venv-hg\lib\site-packages\mercurial\utils\urlutil.py", line 144, in __init__
if parsefragment and b'#' in path:
TypeError: 'in <string>' requires string as left operand, not bytes
Solution if shlib.update_thgstatus(_ui, r.encode('ascii'), wait=False):