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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

python: can't open file - Bamboo

 

I have configured a task as check out source code from Bit-Bucket and it is working fine.

As per some comments I can see the below lines is working fine.

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

 

I an trying to run my python file from the check out source code.

As per the documentation got the current working directory from the below code,

${bamboo.working.directory}

Got the result :
/opt/atlassian/atlassian-bamboo-home-6.4.1/xml-data/build-dir/XXXXSCRIP-XXXXSCRIP-JOB1

 

and My repository path is

ProjectName/app.py

 

Added an script task and given the below as inline comments,

/usr/bin/python /opt/atlassian/atlassian-bamboo-home-6.4.1/xml-data/build-dir/XXXXSCRIP-XXXXSCRIP-JOB1/ProjectName/app.py

 

But, failed to execute. Please see the below error message.

python: can't open file '/opt/atlassian/atlassian-bamboo-home-6.4.1/xml-data/build-dir/XXXXSCRIP-XXXXSCRIP-JOB1/ProjectName/app.py': [Errno 2] No such file or directory

 

How do I solve this issue.

 

1 answer

0 votes
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jul 26, 2019

Hi @Vineesh,

That type of error can have two main causes:

  1. The file is not there.
  2. The file somehow has restricted permissions.

How to mitigate them?

  1. Check if the file is there or add an extra command in your build just to check that.
    You can navigate to that directory in the terminal after the build as well.
    Make sure you are checking the right agent in case you are running this build in a remote agent.
  2. If the file is there, check the permissions to make sure the python command can access the file.

If not of those options are the case, try to navigate to the working directory from the terminal and check if you can run the script using the exact same command Bamboo is using.

Let me know how it goes.

@Vineesh Did you find a solution for this?

@Daniel Santos What if I do not have terminal access to the file? Like, I am using Bamboo in a corporate environment, I do not have access to it.

Found it. It is because of User Permissions.

In case someone has the same problem of not having terminal access. Just Do:

1. Script Task and write Inline, "chmod XXX <filename>".

2. Create another Script Task and call the file there. 

Like Daniel Santos likes this
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Aug 01, 2019

Hi @Bharath_Venkat_Rajan,

I'm sorry, I didn't have time to answer your message.
Yes, I would say that any time you need terminal you can use a script task for that.

I'm glad you found your own way. =]

Like Bharath_Venkat_Rajan likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events