I am new to Ubuntu... I am trying to run my first simple python program "Hello World" ... After running following commands in terminal
1. chmod +x filename.py
2. ./filename.py
terminal is showing following error "bash: ./filename.py: Permission denied"
what can I do for solve about problem?
ls -l filename.pyand post what it says .. I'm curious about the file permission (thoughchmod +x filename.pywould be the right way to make the file executable).#!/usr/bin/env pythonin the first line of your script?#!/usr/bin/env pythonvs#!/usr/bin/pythonI was severely admonished by some person on SO for using the former (which all of my own scripts still do) because presumably you could not be sure which Python would execute in case you had more than one installed, so the idea was to always specify the full path for the one you wanted). Maybe I should make this a question and post it on SO./usr/bin/envis fine. It is simply a way to say "use what you find on myPATH" which is perfectly fine if yourPATHis constructed sanely. I would say it is preferred if you're going to distribute your scripts, because then they will be able to use the end-user'sPATH. But if you have a need to explicitly use one specific Python binary, then yes, by all means, specify that.