From baf928ded2c5380dd71e3aa63c973ffa3f86e17c Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Tue, 13 Apr 2021 14:44:18 +0300 Subject: [PATCH] - Add ConnectionReset except in Server to catch network interactions - Add info about how to use pyOpenRPA with both bitness --- Sources/GuideSphinx/Robot/02_Defs.rst | 15 +++++++++++++++ Sources/pyOpenRPA/Orchestrator/Server.py | 10 +++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Sources/GuideSphinx/Robot/02_Defs.rst b/Sources/GuideSphinx/Robot/02_Defs.rst index 3d289017..c69ecf9a 100644 --- a/Sources/GuideSphinx/Robot/02_Defs.rst +++ b/Sources/GuideSphinx/Robot/02_Defs.rst @@ -4,6 +4,21 @@ Here you can find the functions description for interaction with desktop GUI applications +How to use both x32 and x64 python processes (it can be helpfully, if another app GUI is on another bitness than your app) + +.. code-block:: python + from pyOpenRPA.Robot import UIDesktop + #Section for robot init + lPyOpenRPA_SettingsDict = { + "Python32FullPath": "..\\Resources\\WPy32-3720\\python-3.7.2\\python.exe", #Set from user: "..\\Resources\\WPy32-3720\\python-3.7.2\\OpenRPARobotGUIx32.exe" + "Python64FullPath": "..\\Resources\\WPy64-3720\\python-3.7.2.amd64\\python.exe", #Set from user + "Python32ProcessName": "pyOpenRPA_UIDesktopX32.exe", #Config set once + "Python64ProcessName": "pyOpenRPA_UIDesktopX64.exe" #Config set once + } + # Init the pyOpenRPA configuration + UIDesktop.Utils.ProcessBitness.SettingsInit(lPyOpenRPA_SettingsDict) + # Now you can use pyOpenRPA with both bitness. + .. automodule:: pyOpenRPA.Robot.UIDesktop :members: :autosummary: diff --git a/Sources/pyOpenRPA/Orchestrator/Server.py b/Sources/pyOpenRPA/Orchestrator/Server.py index 2c16b986..5102b1fb 100644 --- a/Sources/pyOpenRPA/Orchestrator/Server.py +++ b/Sources/pyOpenRPA/Orchestrator/Server.py @@ -319,6 +319,7 @@ class testHTTPServer_RequestHandler(BaseHTTPRequestHandler): lFileObject.close() # ResponseContentTypeFile def ResponseDictSend(self): + lL = gSettingsDict["Logger"] inResponseDict = self.OpenRPAResponseDict # Send response status code self.send_response(inResponseDict["StatusCode"]) @@ -329,9 +330,12 @@ class testHTTPServer_RequestHandler(BaseHTTPRequestHandler): for lItemKey, lItemValue in inResponseDict["SetCookies"].items(): self.send_header("Set-Cookie", f"{lItemKey}={lItemValue}") #Close headers section in response - self.end_headers() - # Write content as utf-8 data - self.wfile.write(inResponseDict["Body"]) + try: + self.end_headers() + # Write content as utf-8 data + self.wfile.write(inResponseDict["Body"]) + except ConnectionResetError as e: + if lL: lL.warning(f"An existing connection was forcibly closed by the remote host - OK for the network interactions (ConnectionResetError: [WinError 10054])") def do_GET(self): try: self.OpenRPA = {}