Execute python script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
26-05-22 06:41 AM
can you help me. how to execute python script using blueprism.
thanks and regards,
Ashok
------------------------------
Ashok Rpa
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
26-05-22 06:51 AM
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
----------------------------------
------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
26-05-22 07:33 AM
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
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
26-05-22 07:39 AM
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
----------------------------------
------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
26-05-22 03:25 PM
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
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
13-06-22 01:27 PM
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
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
13-06-22 03:06 PM
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
----------------------------------
------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
31-08-22 01:31 PM
Please tell me, can we execute the script without arguments?
For example
ScriptNameAndArguments: "main.py"
------------------------------
Eugene Ivaniv
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-09-22 04:12 PM
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
----------------------------------
------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
19-11-22 09:08 PM
------------------------------
Tomas Kochan
------------------------------
