Strange Python problem on Linux.

Thomas A. Bryan tbryan at python.net
Wed Mar 1 04:25:37 CET 2000


Michael Hudson wrote:
> 
> "Thomas A. Bryan" <tbryan at python.net> writes:
> [snip]
> > I've never had this problem before in over a year of Python work.
> > Basically, I have a Python program that I can run by typing
> > python filename.py
> > but not by typing
> > ./filename.py
> [snip]
> 
> The only thing I can think of is that the hash-bang line has some
> control characters or other gunk in it - have you tried `cat -v'-ing
> it?

No.  Thanks, that solved the problem.

$ cat -v mdef.py
#!/usr/bin/python^M
....

At work, Xemacs shows the ^M in the file.  I must have copied the 
files onto a floppy over samba at work and gotten the \r before the 
\n at the end of the line.  I had been editing the file in Emacs here 
at home, and I didn't even think of the possibility of their being 
hidden carriage returns in the file.  I suppose Emacs hides them 
from me so that I don't have to see them. :-/ In this case, the result 
was less than ideal...but it was a fun puzzle, no?

Thanks for the help.
---Tom



More information about the Python-list mailing list