On 16/02/06, Brian van den Broek <[EMAIL PROTECTED]> 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:

[EMAIL PROTECTED]:~$ which python
/usr/bin/python
[EMAIL PROTECTED]:~$ cd /media/windata/
[EMAIL PROTECTED]:/media/windata$ ./testerlyfoo.py
Working!
[EMAIL PROTECTED] :/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>
[EMAIL PROTECTED]:~$ ./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.

[EMAIL PROTECTED]:/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@python.org
http://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to