Blue Prism Product

 View Only
last person joined: 17 hours ago 

This community covers the core Blue Prism RPA product.

Expand all | Collapse all

Execute python script

  • 1.  Execute python script

    Posted 05-26-2022 06:41
    Hi,

    can you help me. how to execute python script using blueprism.

    thanks and regards,
    Ashok

    ------------------------------
    Ashok Rpa
    ------------------------------


  • 2.  RE: Execute python script

    Posted 05-26-2022 06:51
    Hi Ashok,

    If you wish to execute any python script on your machine, you can use the following DX exchange asset: Function for Blue Prism - Script Execution VBO - 1.0.0

    Once you import this business object, provide these input and output parameters:


    Here is a sample execution of the business object:



    ------------------------------
    ----------------------------------
    Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future

    Regards,
    Devneet Mohanty
    Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
    WonderBotz India Pvt. Ltd.
    Blue Prism Community MVP | Blue Prism 7x Certified Professional
    Website: https://devneet.github.io/
    Email: devneetmohanty07@gmail.com

    ----------------------------------
    ------------------------------



  • 3.  RE: Execute python script

    Posted 05-26-2022 07:33
    Hi Devneet mohanty,

    Thanks for your response.

    I will try this method, when i run the program the output shows,  the script output is denied.

    thanks and regards 
    ashok


    ------------------------------
    Ashok Rpa
    ------------------------------



  • 4.  RE: Execute python script

    Posted 05-26-2022 07:39
    Hi Ashok,

    Can you type the below command in your cmd and let me know what you get:

    python --version​

    If you get some version number, then check where is your python.exe file once, if the file path is not provided correctly it might show an error. Also, can you post a screenshot of your parameters just to know what kind of data are you putting there as it will help us to know the issue more clearly.

    ------------------------------
    ----------------------------------
    Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future

    Regards,
    Devneet Mohanty
    Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
    WonderBotz India Pvt. Ltd.
    Blue Prism Community MVP | Blue Prism 7x Certified Professional
    Website: https://devneet.github.io/
    Email: devneetmohanty07@gmail.com

    ----------------------------------
    ------------------------------



  • 5.  RE: Execute python script

    Posted 06-13-2022 13:27
    Passing argument from blue prims to python script using Script Execution VBO | Digital Exchange (blueprism.com)

    The above thread answered my question.

    Hi Devneet,

    Could you please share a code snippet of Python script that accepts input parameter from BluePrism and returns the result back to BP?
    without parameters I can execute the script .

    Thanks in advance

    ------------------------------
    Roshini Syed
    ------------------------------



  • 6.  RE: Execute python script

    Posted 06-13-2022 15:06
    Hi Roshini,

    I have created a workflow for your understanding as below:



    Here, ScriptEngineFilePath data item consists of the file path of 'python.exe' file on my machine whereas the ScriptFilePath data item consists of the folder location where my python script is located.

    ScriptNameAndArguments data item consists of the name of the script along with each arguments separated by spaces.

    NOTE: If the script name has spaces then you need to enclose it within double quotes and same also applies for the arguments. For example if the name of my script was Hello World.py and the argument was Hi everyone then I would be setting the value of ScriptNameAndArguments data item as follows: 

    "Hello World.py" "Hi everyone"​


    Now, if you have to make your python script accept arguments and return something out as well, you need to use the sys library to read arguments from command line which you can import in your script using the import sys keyword . Once the library has been imported, we can use the object sys.argv which represents the list of arguments being sent out via command line.

    In my python script, I am sending out two number arguments which I need to add. Hence, to refer to each of these numbers I need to reach out to the index 1 and 2 of the list represented by sys.argv


    sys.argv[1] and sys.argv[2] would correspond to the numbers that I am sending out. Now if I want to return any result from the script to the command line, I can simply print the result out. Hence, in order to return the sum of my arguments, I can simply use a command like:

    print(sys.argv[1] + sys.argv[2])

    So my python script overall will look like this:

    import sys
    
    a = int(sys.argv[1])
    b = int(sys.argv[2])
    
    print(a+b)​




    If you compare the data items being sent against how manually we do it, you would get a mapping like below:



    ------------------------------
    ----------------------------------
    Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future

    Regards,
    Devneet Mohanty
    Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
    WonderBotz India Pvt. Ltd.
    Blue Prism Community MVP | Blue Prism 7x Certified Professional
    Website: https://devneet.github.io/
    Email: devneetmohanty07@gmail.com

    ----------------------------------
    ------------------------------



  • 7.  RE: Execute python script

    Posted 08-31-2022 13:31
    Hi, Devneet!

    Please tell me, can we execute the script without arguments?

    For example
    ScriptNameAndArguments:   "main.py"

    ------------------------------
    Eugene Ivaniv
    ------------------------------



  • 8.  RE: Execute python script

    Posted 09-10-2022 16:12

    Hi Eugene,


    Here where I have indicated Script File Name & Arguments, there just pass the script name ending with .py extension that's all. If let say I wont have any argument written in my above shown example then ideally my command would look like this:

    "C:\Users\DevneetMohanty\AppData\Local\Programs\Python\Python310\python.exe" "addNumbers.py"



    ------------------------------
    ----------------------------------
    Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future

    Regards,
    Devneet Mohanty
    Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
    WonderBotz India Pvt. Ltd.
    Blue Prism Community MVP | Blue Prism 7x Certified Professional
    Website: https://devneet.github.io/
    Email: devneetmohanty07@gmail.com

    ----------------------------------
    ------------------------------



  • 9.  RE: Execute python script

    Posted 11-19-2022 21:08
    Nice. Has someone made actions to execute python / nodejs script not from file but from data item?

    ------------------------------
    Tomas Kochan
    ------------------------------



  • 10.  RE: Execute python script

    Posted 05-26-2022 15:25
      |   view attached

    With Python and the script loaded on the individual VMs, I use Utility Environment VBO action Start Process Read Stderr and Stdout.
    The process name will be "py" (or, perhaps "python" or "python3". Whichever works on your machine.)
    The argument list will start with the path of the script (including the script name) and space delimited arguments required to run the script. 



    ------------------------------
    Steven Browning
    Application Development Specialist
    Accenture
    America/Chicago
    ------------------------------

    Attachment(s)

    tif
    Example.tif   1.93 MB 1 version


  • 11.  RE: Execute python script

    Posted 01-27-2023 08:17
    Thanks Steven. However, the "loaded script" in your example is a python file. I eventually found an easy how to run python script from a Blue Prism data item.

    ------------------------------
    Tomas Kochan
    ------------------------------



  • 12.  RE: Execute python script

    Posted 03-23-2023 09:56

    Hi Tomas

    Can you share your findings regarding running a script from a data item?

    Thank you.



    ------------------------------
    Glenn Filbert
    RPA developer
    Velliv
    Europe/Copenhagen
    ------------------------------



  • 13.  RE: Execute python script

    Posted 03-23-2023 10:11

    @Glenn Filbert Sure, a simple example in pics:



    ------------------------------
    Tomas Kochan
    ------------------------------



  • 14.  RE: Execute python script

    Posted 03-23-2023 10:42

    Thank you, thats perfect.



    ------------------------------
    Glenn Filbert
    Senior RPA developer
    Velliv
    Europe/Copenhagen
    ------------------------------



Welcome to the Blue Prism RPA Product Community!

Whether you’re looking to manage a complex infrastructure, maintain security and compliance, bring new products to market faster, or gain operational speed and agility in an uncertain economy, Blue Prism delivers — with the flexibility you need to create the business you want. From deployment on-premise, through a cloud service provider or as SaaS, to a skillful and adaptable digital workforce that continually expands to meet your enterprise needs, you can gain enhanced operational insight and control while your people reclaim the time they need to focus on great work.

Product PageKnowledge BaseBlue Prism Training Offering
Product Research ProgramUpdates, Releases & Announcements

FAQs

Blue Prism is intelligent automation — business-developed, no-code automation that pushes the boundaries of robotic process automation (RPA) to deliver value across any business process in a connected enterprise.

A combination of RPA with expanded cognitive and AI capabilities, Blue Prism is different than other automation technology on the market. With one Blue Prism license, you gain instant access to an already AI equipped digital workforce, along with the tools you need to build and delegate automations. Click here for more information on Blue Prism and Intelligent Automation.
To learn more about how Blue Prism RPA can help your organization and how much it will cost to get started, please Contact our Sales department.
Blue Prism RPA can be downloaded from our customer portal. If you would like to consume or download any material it is necessary to create an account on the Portal. Once you have registered, you can access the download options for Blue Prism here.
Yes! Installed on your own machine and supported by our training materials and product documentation, you can use all the features of the full enterprise product for free with our Blue Prism Trial – giving you the opportunity to learn the basics before moving to a full production implementation. Click here for more information and to download the trial.
Yes! You can access our known issue list for Blue Prism from our Support Portal.
Regardless of your industry, Blue Prism’s Digital Workforce can adhere to strict governance and compliance standards without limiting productivity. Click here for more information on how your industry can benefit from Blue Prism.