Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i am having a python script

#!/usr/bin/env python

in top of my script? following is the permission i had set

-rwxr-xr-x 1 user1 user2 6423 Nov 15 15:12 test

i tried executing the script as user1 ./test its giving me permission denied?

when i do

whoami it shows user1 and umask is 0022, user1 has bash as his default shell

$python test (it works fine)

Any ideas??

share|improve this question
Are you running this on a volume with the mount option noexec? – gertvdijk Nov 15 '12 at 10:49
@gertvfijk No if that is the case the script wont execute when i try python script name. – LINUX4U Nov 15 '12 at 11:01
Untrue. # ./ -su: ./ Permission denied and # python bla – gertvdijk Nov 15 '12 at 11:08

I remember an issue like that because I had a test.pyc in the same directory, and interpreter was using it instead of the original interpreted one ( Maybe it's a lead for you.

share|improve this answer
thanks, but my org script name is different, for posting in the forum i used test script name is fsetup :-( – LINUX4U Nov 15 '12 at 12:13

When you mention #!/usr/bin/env python in first line, it looks for python from $PATH.

Type which python and check whether the path from the output is added to $PATH. If not add it.

  • export PATH="$PATH:/usr/local/bin/python"

For more information about setting the PATH variable refer this page

share|improve this answer
i am having another script that is set up with same path to python interpretor, that will execute fine with ./script2 but the errror only happens to test script, i dont know what the problem there anything other that PATH i need to look into – LINUX4U Nov 15 '12 at 11:14
No. When you say the other scripts work fine with the same setup. I don't think the problem is with $PATH – devav2 Nov 15 '12 at 12:04

I never ever use names as test as my scriptname. Likewise for simple names as time, date, parser, etc unless in a package with absolute imports, and even then it's bad practice. These names are too likely to interfere with either installed modules or other scripts/packages in your working directory and/or path.

Conclusion: check if you don't have a folder called test in the same directory.

share|improve this answer
test is the name that i had use to post in the form the script name is different it is fsetup – LINUX4U Nov 15 '12 at 12:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.