By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,676 Members | 2,262 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,676 IT Pros & Developers. It's quick & easy.

Bad Interpreter

P: n/a
I have seen some previous messages about such a problem. I have this
problem but it is not clear what the solution really was.

I am running FC2, python 2.3.3

the script i have sock.py runs if i say something like :

python sock.py

but ./sock.py results in a :bad interpreter error
how do i troubleshoot something like this?

regards

Jul 18 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
<Ra************@hotmail.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
I have seen some previous messages about such a problem. I have this
problem but it is not clear what the solution really was.

I am running FC2, python 2.3.3

the script i have sock.py runs if i say something like :

python sock.py

but ./sock.py results in a :bad interpreter error
how do i troubleshoot something like this?

regards


What does the first line of your script look like? It needs to be pointing
to the python interpreter binary, which you can locate with:

which python

(on the command line). Check and make sure it is. If it is and you are
still getting this problem, post some code and the complete error.

HTH.
Jul 18 '05 #2

P: n/a
On Mon, 2005-01-03 at 12:24 -0800, Ra************@hotmail.com wrote:
I have seen some previous messages about such a problem. I have this
problem but it is not clear what the solution really was.

I am running FC2, python 2.3.3

the script i have sock.py runs if i say something like :

python sock.py

but ./sock.py results in a :bad interpreter error
how do i troubleshoot something like this?


You probably have Windows-style line endings in the file. The kernel
sees the ^M at the end of the line and gets all confused.

--
Craig Ringer

Jul 18 '05 #3

P: n/a
On Mon, 03 Jan 2005 12:24:09 -0800, RajaSrinivasan wrote:
I have seen some previous messages about such a problem. I have this
problem but it is not clear what the solution really was.

I am running FC2, python 2.3.3

the script i have sock.py runs if i say something like :

python sock.py

but ./sock.py results in a :bad interpreter error
how do i troubleshoot something like this?


Check the first line of your script - it should set the path to the Python
interpreter. It should look something like this:
#!/usr/bin/python

or
#!/usr/bin/env python

which doesn't explicitly set the path to the interpreter, but checks the
environment variable called python for that path. If your python
executable lives somewhere the first line or the environment variable
doesn't point to, you'll need to correct that.

--
Christopher

OutOfSigError

Jul 18 '05 #4

P: n/a
RajaSriniva...@hotmail.com wrote:
the script i have sock.py runs if i say something like :

python sock.py

but ./sock.py results in a :bad interpreter error
how do i troubleshoot something like this?


sounds like you've been editting the script on a windows machine, and
it's inserted it's evil linefeeds.

on the unix machine run 'dos2unix sock.py', or load sock.py into vi and
remove the ^M characters

Jul 18 '05 #5

P: n/a
sounds like it. vi sock.py shows '$' at the end of each line.

however when i went to a unix machine and recreated the file, the
problem went away.

thanks for all the help

regards

Jul 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.