Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,367,620
Community Members
 
Community Events
168
Community Groups

Inline Python Scripting possible?

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

Just use:

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

as the inline script body.

Once again... you are amazing. Thanks again

when I tried it, I get this error

<< was unexpected at this time.

Like Anchita Birla likes this


@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?

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 Oct 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

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

Atlassian Community Events