LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-26-2003, 12:23 AM   #1
chunkymunky
Newbie
 
Registered: Feb 2003
Distribution: Slack 9.1, Debian 3.1
Posts: 26

Rep: Reputation: 15
script: bad interpreter...


I am trying to learn python and am having trouble getting my python scripts to run. I added #!/usr/bin/python to the top. When i ./pythonscript, I am getting an error message that says /usr/bin/python bad interpreter : permission denied.
I had the same problem with shell scripts until i removed the interpreter thing at the top.

Any suggestions?

Thanks
JT
 
Old 11-26-2003, 12:55 AM   #2
chunkymunky
Newbie
 
Registered: Feb 2003
Distribution: Slack 9.1, Debian 3.1
Posts: 26

Original Poster
Rep: Reputation: 15
I found this but don't know what it means.
This is from another forum:

"Problem solved. Being a Linux n00b, I had the mount properties (in fstab) for the filesystem not allowing symlinks for some reason. I had it set the same way my root filesystem is, but for some reason that didn't work. I changed it, and it works fine now."

I read the fstab man pages and looked for comments in my fstab file but found nothing that mentioned symlinks. How can I check for this and how can I change it if it needs to be changed?

Thanks
JT
 
Old 11-26-2003, 10:32 AM   #3
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
I'd guess that you either don't have permission to execute the script (chmod 777 scriptname) or that you can't execute python.
 
Old 11-26-2003, 03:33 PM   #4
sykkn
Member
 
Registered: Apr 2001
Location: Texas
Distribution: Mandrake 8.0, RedHat 7.1
Posts: 48

Rep: Reputation: 15
check your permissions on /usr/bin/python. just executing a file that does not have execute permission will not give you the "bad enterpreter" message.
 
Old 11-27-2003, 01:12 AM   #5
chunkymunky
Newbie
 
Registered: Feb 2003
Distribution: Slack 9.1, Debian 3.1
Posts: 26

Original Poster
Rep: Reputation: 15
Nope

chmod 777 on python didn't work. Any other suggestions? I can run the python interpreter fine by the way. but just can't run python scripts...

thanks,
JT
 
Old 12-24-2003, 10:43 AM   #6
pacopablo
LQ Newbie
 
Registered: Dec 2003
Location: Oregon, USA
Distribution: Gentoo
Posts: 1

Rep: Reputation: 0
Just ran into this same problem, and your post helped point me in the right direction. My problem was that I was working on a vfat mounted file system which had been mounted by my user, not root. While I had my problem, the line in my fstab looked like this:

/dev/hda2 /mnt/dump vfat user,noauto,noatime,umask=000 0 0

and the resulting line in the output of mount was the following:

/dev/hda2 on /mnt/dump type vfat (rw,noexec,nosuid,nodev,noatime,umask=000,user=pacopablo)

So, when I read your post about symlinks and not being able to execute them, I thought "hmm, that noexec looks funny" so I added exec to the options in my fstab as such:

/dev/hda2 /mnt/dump vfat user,noauto,exec,noatime,umask=000 0 0

unmounted the FS and then remounted it and BAM! it worked. Thanks for the help and I hope this helps someone in the future.
 
Old 12-25-2003, 09:58 PM   #7
fr0zen
Member
 
Registered: Nov 2003
Location: 127.0.0.1
Distribution: xubuntu
Posts: 217

Rep: Reputation: 30
I had this same problem yesterday. The problem was the file I was trying to execute had DOS carriage returns in it.

The fix was simple: dos2unix < oldfile > newfile
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
init.d script error bad interpreter snowmedia Red Hat 8 10-01-2011 06:16 PM
User executing script: bad interpreter: Permission denied stefaandk Linux - Newbie 7 06-27-2005 09:53 AM
bad interpreter in script c0d3 Programming 11 12-15-2004 04:48 AM
bad interpreter???? yenonn Programming 4 09-25-2004 05:21 AM
bad interpreter penzilsinc Linux - Newbie 5 06-26-2002 01:51 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration