[Chicago] Windows end-of-line and Python

Jonathan Hayward jonathan.hayward at pobox.com
Sun Feb 20 01:22:11 CET 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20110219/a087e362/attachment-0001.html>


More information about the Chicago mailing list