cross-platform imports: import hook for end-of-line conversion

Pete Shinners shredwheat at mediaone.net
Tue May 29 12:08:17 EDT 2001


"David Goodger" <dgoodger at bigfoot.com> wrote
> This code eliminates the need to convert line endings when moving .py
> modules between OSes. Although Python already does Unix <-> Windows, this
> import hook lets Mac play too.

brilliant, i'd hope this, or something similar to this, can
get moved into the python source. the one thing it is still
missing is the problem with

#!/usr/bin/env python

and line endings, but that is more a shell problem than a
python problem. still there may be some way to "fool" the
shell/python interaction to ignore any incorrect linefeeds,
like some sort of "ignore" flag that would eat the linefeed

#!/usr/bin/env python -eat

that would definitely run on unix with windows linefeeds. i
don't know if it would fly on unix with mac linefeeds though?







More information about the Python-list mailing list