[Tutor] problems with the shebang line and linux

Adam adam.jtm30 at gmail.com
Thu Feb 16 15:23:25 CET 2006


On 16/02/06, Brian van den Broek <broek at cc.umanitoba.ca> wrote:
>
> 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


It seems to me that that ^M is your problem although I'm not quite sure
where it came from there seems to be an extra character on the end of the
copied one. Here's a little test I did:
<code>
#! /bin/py
print "What the hell!!"
</code>
adam at darkstar:~$ ./test.py
-bash: ./test.py: /bin/py: bad interpreter: No such file or directory
and there doesn't seem to be any weird thing on the end even though that
file doesn't exist.

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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060216/96174ff1/attachment.htm 


More information about the Tutor mailing list