[Chicago] Windows end-of-line and Python

Jon Sudlow jsudlow at gmail.com
Thu Mar 3 02:36:45 CET 2011

I had to grapple with this very issue when parsing a 3d data set. I just
used a regex and cut the \n and the \rs out of it so it wouldn't get

Show your friend some data structures in python, that will change their

As to whether its a bug or not Im not sure.

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/85a04ea9/attachment.html>

More information about the Chicago mailing list