I am trying to create python scripts in script-runner but I am unable to figure out how to return values to the UI or to a log file so I can validate that my script is functioning as intended. Here is a very basic example script which which works for both groovy and python, but returns no information in python.:
Groovy:
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.Issue def cmgr = ComponentManager.getInstance() def issue = cmgr.getIssueManager().getIssueObject("PROJ-431") return issue.key
Python:
from com.atlassian.jira import ComponentManager import com.atlassian.jira.issue.Issue cmgr = ComponentManager.getInstance() issue = cmgr.getIssueManager().getIssueObject("PROJ-431") print issue.key
Can someone point me in the right direction to get output from the python interpretor, either through log4j, which I am unable to load in the python interpretor or just as a return value in script-runner UI?
"print" will print to catalina.out.
> either through log4j, which I am unable to load in the python interpretor
What have you tried? I don't see why that wouldn't work.
To get the UI to display the return value you just need to "return" it, but that's not very flexible, you're better off with log4j.
Thanks, I think this was just an issue with learning curve :) Attempting to "return" a value in scriptrunner causes an error stating
SyntaxError: 'return' outside function in <script> at line number 7 at column number 0
I have managed to get log4j working, I was just importing it wrong.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.