Hi Brian, it's the ^M characters that are catching you out here.
Often files from a windows PC will have ^M as the newline char when viewed in linux/unix. On linux you should be able to check if a file has ^M in by running either 'vi -b filename' or 'sed -n l filename'. Try this with the file vi filename escape :%s/^M// That should get rid of all the ^M chars. (not on linux at the mo so not 100% sure). The ^M is done in vi by actually typing in 'Ctl-V M' not shift6 M. What I wrote above may not sound too clear, but feel free to email me off list if you need any vi or linux commandline help (altho ive never used ubuntu so anything ubuntu specific I wont be much use with). Good luck, Nick . > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Behalf Of Brian van den Broek > Sent: 16 February 2006 13:36 > 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: > > [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 > [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 > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.375 / Virus Database: 267.15.9/261 - Release Date: 15/02/2006 > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor