You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.8 KiB
39 lines
1.8 KiB
5 years ago
|
r"""
|
||
|
The OpenRPA package (from UnicodeLabs/Ivan Maslov)
|
||
|
__main__ file goes outside the package and used like a main file when the python runs module directly from start
|
||
|
"""
|
||
|
#If run as python executable module, need to set python path in pyOpenRPA package to load subpackge
|
||
|
import sys
|
||
|
lFolderPath= "\\".join(__file__.split("\\")[:-1])
|
||
|
sys.path.append(lFolderPath)
|
||
|
################################
|
||
|
import traceback
|
||
|
from Core import ProcessCommunicator
|
||
|
from Core import JSONNormalize
|
||
|
from Core import UIDesktop
|
||
|
##########################################
|
||
|
#Run UIDesktop from new process. Communication with paren process by PIPE channel
|
||
|
##########################################
|
||
|
#Определить разрядность процесса
|
||
|
buffer = ""
|
||
|
lJSONInputString=""
|
||
|
while True:
|
||
|
#Reset the lProcessResponse
|
||
|
lProcessResponse={"ErrorFlag":False}
|
||
|
try:
|
||
|
#Ожидаем синхронно поступление объекта
|
||
|
lJSONInput = ProcessCommunicator.ProcessParentReadWaitObject()
|
||
|
lProcessResponse["ActivitySpecificationDict"]=lJSONInput
|
||
|
#Выполнить вызов функции
|
||
|
lFunction = getattr(UIDesktop,lJSONInput['ActivityName'])
|
||
|
lProcessResponse["Result"]=JSONNormalize.JSONNormalizeDictListStrIntBool(lFunction(*lJSONInput['ArgumentList'],**lJSONInput['ArgumentDict']))
|
||
|
except Exception as e:
|
||
|
#Установить флаг ошибки
|
||
|
lProcessResponse["ErrorFlag"]=True
|
||
|
#Зафиксировать traceback
|
||
|
lProcessResponse["ErrorTraceback"]=traceback.format_exc()
|
||
|
#Зафиксировать Error message
|
||
|
lProcessResponse["ErrorMessage"]=str(e)
|
||
|
#lProcessResponse["ErrorArgs"]=str(e.args)
|
||
|
#Отправить ответ в родительский процесс
|
||
|
ProcessCommunicator.ProcessParentWriteObject(lProcessResponse)
|