Thanks to all for the replies. Indeed, it must have been the DOS vs. 
Unix line terminators as several people suggested.

A couple of comments in-line below.

Roel Schroeven said unto the world upon 16/02/06 11:14 AM:

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

<snip>

> That ^M looks familiar to me: normally it means that the file is in 
> DOS/Windows format instead of UNIX format, i.e. with CR/LF at the end of 
> each line instead of only CR. Converting the file with dos2unix or a 
> similar utility should solve the problem in that case.

While I'm unable to recall exactly what I did, this must have been it. 
I *think* I created the offending file while running ubuntu, but 
launched IDLE by using a right-click context menu entry for "Open with 
IDLE" on a file originally created earlier today while running 
Windows. So, my guess is that doing this put IDLE into Win endings mode.

> I guess it's there because the file comes from a FAT32 file system, and 
> I presume it has mount options that make the filesystem translate the 
> line endings automatically (though I don't know if such an option even 
> exists).

This doesn't seem to be the case as older .py files created on Windows 
before the last Windows reinstall that inspired me to try ubuntu show 
Unix endings. (Knowing that Windows takes Unix endings just fine for 
.py's, I'd set my previous Windows install's IDLE to use Unix endings. 
I guess I didn't make that setting after reinstalling Windows.)

> Strange thing is that the problem persists after retyping the file, but 
> I guess that's because the editor was still in CR/LF mode. Did you 
> create a new file before starting to retype, or did you just clear 
> everything?

Just cleared. So, somewhere in the complex of ill-recalled events 
surely lives the answer.

Anyway, thanks again to all for the help!

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

Reply via email to