Strange Python problem on Linux.

aflinsch avflinsch at att.net
Wed Mar 1 12:16:02 EST 2000


"Thomas A. Bryan" wrote:
> 
> I'm running Red Hat Linux 6.0, kernel 2.2.5-15, with Python 1.5.2
> (#1, Apr 18 1999, 16:03:16)  [GCC pgcc-2.91.60 19981201 (egcs-1.1.1
> on linux2...
> 
> 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
> 
> filename.py is executable, and if I cut its #! line into another
> script, I can run the second script without invoking the
> interpreter explicitly at the command line.  It's only happening with
> this one file; I've never had this problem with other Python programs.
> I have no idea what's wrong.  Any hints would be appreciated.  I don't
> trust myself at the moment, so I'm pasting a short session from my
> terminal window here.
> 

I had the exact same problem just the other day. It was caused by
initialy creating the program using an editor under windows which left
a \r at the end of the shebang line. Just delete the line and retype
it or remove the \R at the end of the line.



More information about the Python-list mailing list