Bad Interpreter

R

RajaSrinivasan

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
 
R

Richards Noah \(IFR LIT MET\)

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.
 
C

Craig Ringer

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.
 
C

Christopher Koppler

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.
 
S

Simon John

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
 
R

RajaSrinivasan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top