faqts : Computers : Programming : Languages : Python : Common Problems : Shell Scripts

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 7 people (57%) answered Yes
Recently 1 of 3 people (33%) answered Yes

Entry

Why can I run an executable program using "python prog.py" but not as "./prog.py"?

Nov 2nd, 2004 07:37
Jonathan Schroder, Xcrash, Michael Hudson, Nathan Wallace, Michael Hudson


So long as your python file is executable by you, starts with 
 
#!/path/to/executable (usually #!/usr/bin/env python) 
 
and /path/to/executable actually exists, you might have problems with 
control characters having crept into the line - try `cat -v'-ing it. 
 
 
Check the file perms with 'ls -l' and if the file, in this  
case "prog.py", isn't set executable make it so with 'chmod u+x 
prog.py'