473,394 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Bad Interpreter

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
5 5108
<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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Neil Benn | last post by:
Hello, I'm looking at a small app which would need a very quick startup time for the Python interpreter. It doesn't do much (copying and caching of files, no GUI) but I need the Python...
12
by: Anon | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello all I am a beginner teaching myself python, and I am enjoying it immensely :) As a language it is great, I real treat to study, I actually...
1
by: Donnie Leen | last post by:
I wrote a program embbed boost.python, each thread running a sub-interpreter, i made a module implement by boost.python, and i wish this module imported in each sub-interpreter, i find that the...
12
by: Rex Eastbourne | last post by:
Hi, I'm interested in running a Python interpreter in Emacs. I have Python extensions for Emacs, and my python menu lists "C-c !" as the command to run the interpreter. Yet when I run it I get...
4
by: Ian Giblin | last post by:
I am an experienced C programmer, learning C++ by writinging a mathematical toolkit in the framework of a script interpreter. I am posting here to ask for advice (or references) on the object...
12
by: ozbear | last post by:
If one were writing a C interpreter, is there anything in the standard standard that requires the sizeof operator to yield the same value for two different variables of the same type? Let's...
6
by: gr | last post by:
hi.. I must implement an interpreter in C programming language that will get the source code of a program in text file format and execute it. but i don't know C language enough to write this...
3
by: Robin Becker | last post by:
As part of some django usage I need to get some ReportLab C extensions into a state where they can be safely used with mod_python. Unfortunately we have C code that seems incompatible with...
40
by: castironpi | last post by:
I'm curious about some of the details of the internals of the Python interpreter: I understand C from a hardware perspective. x= y+ 1; Move value from place y into a register Add 1 to the...
5
by: Erik Hahn | last post by:
I'm looking for a standalone Javascript interpreter like the ones of Perl and Python. Does such a thing exist for Linux? Thanks in advance. -Erik --...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.