Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Inline Python Scripting possible?

Cameron Ferguson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2011

Is it possible with inline scripts to be able to use python? I know it does bash scripting just fine, didn't know if there was a plugin that could do inline python or not.

4 answers

1 accepted

0 votes
Answer accepted
Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 23, 2011

Just use:

/usr/bin/python <<EOF
print "Hello, World!"
EOF

as the inline script body.

Cameron Ferguson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2011

Once again... you are amazing. Thanks again

Kavi Manohar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 26, 2018

when I tried it, I get this error

<< was unexpected at this time.

Like Anchita Birla likes this
Landon Cooper March 1, 2019


@Przemek Bruski  thank you for your reply

I am still getting error when attempting an python script "inline".  I know your response is straight forward but can you elaborate more on how to achieve a python script inline?

0 votes
Frederik April 9, 2018

If you want to execute a longer script and use the "Command" task with a Python executable in order to have the Python capability automatically added you can do the following:

  1. Add a script task with code like this:
    cat <<EOF >script.py

    print "Hello, World!"

    EOF
  2. Add a command task with executable "python" and argument "script.py"
0 votes
ReneR
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 24, 2011

Then again, anything non trivial should probably go into a file anyway.

Definitely. You can backup your database. But any build scripts should always be part of your source repository, whenever possible. You don't want to do a lot of 'hidden magic' that exists only in Bamboo Tasks (or any other CI tool for that matter)

0 votes
Brent Villalobos
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2011

python -c "print 'Hello, World!'"

Maybe not the best solution for a large amount of python code. Then again, anything non trivial should probably go into a file anyway.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events