[Tutor] problems with the shebang line and linux

Senthil_OR at Dell.com Senthil_OR at Dell.com
Thu Feb 16 15:22:06 CET 2006


>> bash: ./testerlybar.py: /usr/bin/python^M: bad interpreter: No such
file or directory brian at Cedric:/media/windata$

Note the ^M  the additional fileformat character inserted. That is
causing the problem.

Instead of copying and pasting try to use cp file1 file2.
Else, open the copied file and try to remove ^M from it. Under vim, it
is :%s/\r//g ( this removed the additional line break character which
your editor or something had introduced.

-- 
Senthil



-----Original Message-----
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On
Behalf Of Brian van den Broek
Sent: Thursday, February 16, 2006 7:06 PM
To: Tutor
Subject: [Tutor] problems with the shebang line and linux

Hi all,

I've switched to Linux fairly recently and am still at the fumbling
about stage :-)  I'm having a devil of a time with the shebang line and
running a py file from a command line.

I wrote the following little test script with IDLE 1.1.2 under Python
2.4.2 on Ubuntu 5.10:

<code>
#!/usr/bin/python
print "Working!"
</code>

I then C & P'ed it to another .py file. testerlyfoo.py is the original,
testerlybar.py is the pasted copy.

Here's my command line results:

brian at Cedric:~$ which python
/usr/bin/python
brian at Cedric:~$ cd /media/windata/
brian at Cedric:/media/windata$ ./testerlyfoo.py Working!
brian at Cedric:/media/windata$ ./testerlybar.py
bash: ./testerlybar.py: /usr/bin/python^M: bad interpreter: No such file
or directory brian at Cedric:/media/windata$

I even retyped the testerlybar.py file, but I end up with the same
results as when the small script was copied and pasted.

Likewise, I got the same results after saving the two files to my Home
directory on the hail mary thought that perhaps the fact I'd save the
originals on a FAT32 mounted drive might be making things goofy.

I'm stumped. Any steps I can take to work out what's going on?

Best to all,

Brian vdB
_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list