Bad interpreter

B

BaBS

I've a problem whith my python script,
i chmod'ed it to +x, addes the line :
#!/usr/bin/python2.3
and i verified that /usr/bin/python2.3 exists
but i've something like
: bad interpreter: No such file or dir ...

What's the matter ??

Thanx
 
P

Peter Hansen

BaBS said:
I've a problem whith my python script,
i chmod'ed it to +x, addes the line :
#!/usr/bin/python2.3
and i verified that /usr/bin/python2.3 exists
but i've something like
: bad interpreter: No such file or dir ...

What's the matter ??

Remove the hidden CR character which you got at the end of the
lines by moving the file to a Windows system and editing it. ;-)

This one is pretty tricky to figure out the first few times...

-Peter
 
B

BaBS

Le Wed, 26 May 2004 07:08:50 -0400, Peter Hansen a écrit :
Remove the hidden CR character which you got at the end of the
lines by moving the file to a Windows system and editing it. ;-)

This one is pretty tricky to figure out the first few times...

-Peter

Thanks for the tips but ... i don't have CR Character ...
i edit my file with notepad and editplus but no matter what
It's the same message :/
 
P

Peter Hansen

BaBS said:
Le Wed, 26 May 2004 07:08:50 -0400, Peter Hansen a écrit :

Thanks for the tips but ... i don't have CR Character ...
i edit my file with notepad and editplus but no matter what
It's the same message :/

It's either that or /usr/bin/python2.3 doesn't really exist.
If you type "/usr/bin/python2.3" at the prompt, does the
interpreter come up properly? If it does, try creating a
new file without using an editor. Type the commands below
at the Linux $ prompt:

$ cat >test.py
#!/usr/bin/python2.2
print 'works'
(hit Ctrl-D here to close the file)
$ chmod +x test.py
$ ./test.py
works

If you don't get the final output, but still get the "bad
interpreter" thing, yet if the interpreter works properly
when you execute it directly, then I have no idea and will
be quite interested to learn the final solution.

-Peter
 
B

BaBS

Le Wed, 26 May 2004 07:51:42 -0400, Peter Hansen a écrit :
It's either that or /usr/bin/python2.3 doesn't really exist.
If you type "/usr/bin/python2.3" at the prompt, does the
interpreter come up properly? If it does, try creating a
new file without using an editor. Type the commands below
at the Linux $ prompt:

$ cat >test.py
#!/usr/bin/python2.2
print 'works'
(hit Ctrl-D here to close the file)
$ chmod +x test.py
$ ./test.py
works

If you don't get the final output, but still get the "bad
interpreter" thing, yet if the interpreter works properly
when you execute it directly, then I have no idea and will
be quite interested to learn the final solution.

-Peter

/usr/bin/python2.3 exists, it starts perfectly, when i use
a alias mysoft="/usr/bin/python2.3 /path/to/my_script"
it works perfectly too ...

i got a small script ... it's work perfectly too ...
with the chmod +x and the ./script ...

I'm lost, i've no idea :)

--
Damien
++
I've lost my mind ...
But it's on a backup tape ...
... somewhere ...
 
J

Jan Voges

Hi!

Am Wed, 26 May 2004 13:21:28 +0200 schrieb BaBS:
Thanks for the tips but ... i don't have CR Character ...

Are you sure? Aren't there "^M"s at the line ends, when you
type 'cat -v myscript.py'?

Jan
 
B

Benjamin Niemann

Peter said:
Remove the hidden CR character which you got at the end of the
lines by moving the file to a Windows system and editing it. ;-)

This one is pretty tricky to figure out the first few times...
Should be the other way 'round: If you edit the file under Windows (e.g.
with Notepad), (invisible) CRs are added. Use a windows editor that
supports "Unix" lineendings (e.g. UltraEdit: File->Conversions->DOS to
UNIX).
One way to fix this on a Linux/UNIX system would be:
tr -d '[\r]' <script.py >fixed_script.py
 
P

Peter Hansen

Benjamin said:
Should be the other way 'round: If you edit the file under Windows (e.g.
with Notepad), (invisible) CRs are added.

We're saying the same thing. You call them invisible, I call
them hidden, and we're both saying they got added when he
edited the file under Windows. If he were to open the file in, say,
"vi" instead, on Linux, it would display the ^M endings, no doubt,
at least if he entered ":set list" to display invisible characters.
One way to fix this on a Linux/UNIX system would be:
tr -d '[\r]' <script.py >fixed_script.py

Good idea.

-Peter
 
P

Peter Hansen

Peter said:
We're saying the same thing.

Ah, I see you understood me to be saying that "by moving the
file to a Windows system you can remove the CR characters".

My intended meaning was "you got the CR characters
by moving the file to a Windows system", and I wasn't giving
him any idea how to remove them. :)

Confusion solved...

-Peter
 
B

BaBS

Le Wed, 26 May 2004 14:57:09 +0200, Benjamin Niemann a écrit :
Peter said:
Remove the hidden CR character which you got at the end of the
lines by moving the file to a Windows system and editing it. ;-)

This one is pretty tricky to figure out the first few times...
Should be the other way 'round: If you edit the file under Windows (e.g.
with Notepad), (invisible) CRs are added. Use a windows editor that
supports "Unix" lineendings (e.g. UltraEdit: File->Conversions->DOS to
UNIX).
One way to fix this on a Linux/UNIX system would be:
tr -d '[\r]' <script.py >fixed_script.py


Oké thanx, I probably forget something when i edit it under
EditPlus [which handle the CR] but usualy, emacs show me the ^M :/
Anyway ... i don't use windows anymore :)


Thanx a lot everybody ...

--
Damien
++
I've lost my mind ...
But it's on a backup tape ...
... Somewhere ...
 
B

BaBS

Le Wed, 26 May 2004 09:49:09 -0400, Peter Hansen a écrit :
Ah, I see you understood me to be saying that "by moving the
file to a Windows system you can remove the CR characters".

My intended meaning was "you got the CR characters
by moving the file to a Windows system", and I wasn't giving
him any idea how to remove them. :)

Confusion solved...

-Peter


1000 times sory, misunderstand :)
I read too fast :)

Thanx anyway :)

--
Damien
++
I've lost my mind ...
But it's on a backup tape ...
... somewhere ...
 

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,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top