[Chicago] Windows end-of-line and Python

Fawad Halim fawad at fawad.net
Thu Mar 3 03:21:05 CET 2011


It seems extremely unlikely that Python would not like \r\n in source code.
Have you tried reducing the problem to a simple case? The Python Language
Reference says that any of the platform line separators can be used for
newlines.

-fawad

On Sat, Feb 19, 2011 at 6:22 PM, Jonathan Hayward <
jonathan.hayward at pobox.com> wrote:

> Today I was visiting with a friend and installing OSS on his computer. On
> an x86_64 Windows 7 box, he had already installed Apache, and I installed
> Python with a python.org installer. I opened up Notepad and created a
> "Hello world" Python CGI script, put it in the cgi-bin directory, saw it
> crash, and looked in the logs.
>
> The log message complained that I had tried to "import cgi\r": in other
> words, Python on Windows was choking because the file I made in Notepad used
> "\r\n" for line breaks. (The equivalent script made with vim, and presumably
> "\n" for line breaks worked predictably.)
>
> Isn't it a defect/design flaw for Python on Windows to choke on
> "\r\n"-separated files? Should I file a bug, or is this a side effect of
> decisions that are now non-negotiable? (I wasn't thrilled, after trying to
> sell my friend on the idea that Python is a good language with a low barrier
> to entry, to find that it choked on a Notepad-edited "Hello world!" CGI
> script.)
>
> --
> → Jonathan Hayward, Author, Django JavaScript Integration: AJAX and jQuery
> <https://www.packtpub.com/django-javascript-integration-ajax-and-jquery/book>
> → Author Bio <https://www.packtpub.com/authors/profiles/jonathan-hayward>• LinkedIn
> Profile <http://www.linkedin.com/in/jonathanhayward> •
> jonathan.hayward at pobox.com
> → Ajax, CGI, CMS, CSS, Django, HTML, IA, JSON, JavaScript, LAMP, Linux,
> MVC, Perl, PHP, Python, SQL, UI, Unix, Usability, UX, XHTML, XML
> → With a good interest in the human side of computing and making websites a
> joy to use
>
>
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20110302/1d77e74c/attachment-0001.html>


More information about the Chicago mailing list