Shebang line on Windows?

D'Arcy J.M. Cain darcy at
Mon Feb 25 18:29:58 CET 2013

On Mon, 25 Feb 2013 10:18:44 -0700
Michael Torrie <torriem at> wrote:
> On 02/25/2013 06:14 AM, Dave Angel wrote:
> > It's not Python that needs dos2unix, it's bash or equivalent.  For
> > some reason, bash shebang processing still isn't tolerant of a
> > trailing cr on the line. Python doesn't care.
> Actually, the shell isn't involved in parsing the shebang line at all.
> That's actually done in the kernel by the program loader.  So it's the
> kernel that has a problem with it; wonder if Linus would accept a
> patch to ignore the tailing CR?

So much the wrong solution.  First of all, I don't think that Linus is
on the bash development team so he can't help there.  Also, bash is not
the only shell in the world.  And, Linux is not the only operating
system in the world.  There are still a lot of Unix systems (the system
that Linux is a clone of) out there.  FreeBSD, NetBSD, Solaris, Mac
OSX, etc.  You can't expect all of them to bend over backwards for
every Windows wart out there.

I don't run Windows myself so I can't test it but doesn't Python on
Windows work fine with Unix style EOL?  So why not strip out the CR and
run the same file everywhere?

D'Arcy J.M. Cain <darcy at>         |  Democracy is three wolves                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.
IM: darcy at Vex.Net, VOIP: sip:darcy at Vex.Net

More information about the Python-list mailing list