Basico-PS / AutomationOrchestrator

Automation Orchestrator application to orchestrate and manage digital process automation (RPA)
BSD 3-Clause "New" or "Revised" License
36 stars 6 forks source link

Triggering Python Files #51

Closed andriussi closed 4 years ago

andriussi commented 4 years ago

Hi

I tried to set up the orchestrator to trigger a python script instead of a Foxtrot file and got into issue with library import:

[17/Jun/2020 09:53:13] "GET /login/?next=/ HTTP/1.1" 200 2161
Traceback (most recent call last):
  File "C:\send_email.py", line 1, in <module>
    import win32com.client as win32
  File "C:\Python\Python37-32\lib\site-packages\win32com\__init__.py", line 5, in <module>
    import win32api, sys, os
ImportError: DLL load failed: The specified procedure could not be found.
[17/Jun/2020 09:53:23] "GET / HTTP/1.1" 302 0

However when I run it on Orhestrator's python ("C:\AutomationOrchestrator\venv\Scripts\python.exe") file everyting runs fine.

Or if I trigger python script using python IDLE, it runs fine using the installed python (C:\Python\Python37-32)

Do you know why this could be the case?

mbalslow commented 4 years ago

Hi @andriussi,

Could you provide a screenshot of your Botflow and Trigger setup in the Orchestrator + a snippet or screenshot of your Pytyon script (or at least the import statements).

Looks like something is not set up or working correctly in terms of the Python interpreter.

andriussi commented 4 years ago

image

image

image

import win32com.client as win32

def send_email():
    outlook = win32.Dispatch('outlook.application')
    mail = outlook.CreateItem(0)
    mail.To = 'EMAIL ADDRESS'

    mail.Subject = "aa"
    mail.Body = "aa"

    mail.Send()

send_email()

Running same script with IDLE: image

mbalslow commented 4 years ago

And you are completely sure that the IDLE you have opened there is the same as in the specified file? What if you go to the specified Python interpreter (the one used in the Orchestrator), double-click to open the shell, then run "import win32com.client as win32"

andriussi commented 4 years ago

I'm sure. image also I tried this: image

andriussi commented 4 years ago

Just thought that this could be related to 32 vs 64 bits. Will test it now and get back

andriussi commented 4 years ago

The issue was related to python versions. I had 32 bit version installed and it could not be executed with 64bit orchestrator version. When I installed 64bit python and entered that path to bot it runs without issues.

mbalslow commented 4 years ago

Great @andriussi