Can I call and run a Python script from within a Groovy script?

Alexis Evans September 8, 2022

I am using Jira automation to a run a Groovy script from Scriptrunner. Can I use that script to run a Python script? It's in the same directory, and it works successfully when I run it manually, but now I just need to run it automatically when the Groovy script is run.

1 answer

1 accepted

1 vote
Answer accepted
Florian Bonniec
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 8, 2022

Hi @Alexis Evans 

You should be able to execute a command from your script.

https://groovy-lang.gitlab.io/101-scripts/basico/command_local-en.html

 

This command can be python ./mypytonscript.py for instance.

Regards

Alexis Evans September 9, 2022

Thanks for the link, that's helpful!

One question I have is about how to actually execute the command. When you set a string equal to "command".execute() then does the command actually execute when the script is run? Or is there something else I have to do?

Suggest an answer

Log in or Sign up to answer