This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: On Windows, Python crashes on ANSI / Windows-formatted source files
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: JonathanHayward, skrah
Priority: normal Keywords:

Created on 2011-02-23 00:22 by JonathanHayward, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg129142 - (view) Author: Jonathan Hayward (JonathanHayward) Date: 2011-02-23 00:22
So far as I can tell, Python 2.7 crashes on at least some ANSI / Windows \r\n-delimited source files. More specifically, as invoked by Apache as a CGI script, the source file line:

import cgi

generated an error logged by Apache, complaining that the module "cgi\r" couldn't be imported.

Email sent as follows:

--

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.)
msg129256 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2011-02-24 09:21
Python works fine with Notepad generated scripts. I think this is a
CGI issue. Try following this tutorial:

http://www.imladris.com/Scripts/PythonForWindows.html


If you still suspect a bug, you should provide the exact CGI script
and all details of the Apache configuration.
msg129269 - (view) Author: Jonathan Hayward (JonathanHayward) Date: 2011-02-24 15:15
Thank you; noted. I'm closing the bug for now at least; I'll reopen it if need be.
History
Date User Action Args
2022-04-11 14:57:13adminsetgithub: 55504
2011-02-24 15:15:03JonathanHaywardsetstatus: open -> closed

messages: + msg129269
resolution: not a bug
2011-02-24 09:21:02skrahsetnosy: + skrah
messages: + msg129256
2011-02-23 00:22:25JonathanHaywardcreate