'Cant dump pywinauto when using rpyc

Trying to use the following code or similar via rpyc and got the following error consistently:

...:     import pywinauto
...:     from pywinauto import application
...: 
...:     app = application.Application(backend="uia")
...:     handle = pywinauto.findwindows.find_window(best_match="notepad") 
...:     my_app = app.connect(handle=handle)
...:     return my_app

but got the following dump:

Exception in thread Thread-49:
Traceback (most recent call last):
  File "C:\Python39\lib\threading.py", line 973, in _bootstrap_inner
    self.run()
  File "C:\Python39\lib\threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Python39\lib\site-packages\rpyc\utils\server.py", line 182, in _authenticate_and_serve_client
    self._serve_client(sock2, credentials)
  File "C:\Python39\lib\site-packages\rpyc\utils\server.py", line 204, in _serve_client
    self._handle_connection(conn)
  File "C:\Python39\lib\site-packages\rpyc\utils\server.py", line 210, in _handle_connection
    conn.serve_all()
  File "C:\Python39\lib\site-packages\rpyc\core\protocol.py", line 412, in serve_all
    self.serve(None)
  File "C:\Python39\lib\site-packages\rpyc\core\protocol.py", line 396, in serve
    self._dispatch(data)
  File "C:\Python39\lib\site-packages\rpyc\core\protocol.py", line 362, in _dispatch
    self._dispatch_request(seq, args)
  File "C:\Python39\lib\site-packages\rpyc\core\protocol.py", line 338, in _dispatch_request
    self._send(consts.MSG_REPLY, seq, self._box(res))
  File "C:\Python39\lib\site-packages\rpyc\core\protocol.py", line 237, in _send
    data = brine.dump((msg, seq, args))
  File "C:\Python39\lib\site-packages\rpyc\core\brine.py", line 345, in dump
    _dump(obj, stream)
  File "C:\Python39\lib\site-packages\rpyc\core\brine.py", line 182, in _dump
    _dump_registry.get(type(obj), _undumpable)(obj, stream)
  File "C:\Python39\lib\site-packages\rpyc\core\brine.py", line 174, in _dump_tuple
    _dump(item, stream)
  File "C:\Python39\lib\site-packages\rpyc\core\brine.py", line 182, in _dump
    _dump_registry.get(type(obj), _undumpable)(obj, stream)
  File "C:\Python39\lib\site-packages\rpyc\core\brine.py", line 174, in _dump_tuple
    _dump(item, stream)
  File "C:\Python39\lib\site-packages\rpyc\core\brine.py", line 182, in _dump
    _dump_registry.get(type(obj), _undumpable)(obj, stream)
  File "C:\Python39\lib\site-packages\rpyc\core\brine.py", line 178, in _undumpable
    raise TypeError("cannot dump %r" % (obj,))
TypeError: cannot dump <pywinauto.application.WindowSpecification object at 0x000001FA903E8DF0>

it obviously rpyc bug - wonder if someone tackled or fixed on later versions

pywinauto==0.6.8
rpyc==5.0.1

Thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source