[Tutor] problems with the shebang line and linux

Brian van den Broek broek at cc.umanitoba.ca
Thu Feb 16 14:36:15 CET 2006


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


More information about the Tutor mailing list