GNU bug report logs - #18596
25.0.50; MS-Windows needs a different default for python-shell-interpreter-args

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Wed, 1 Oct 2014 15:14:01 UTC

Severity: normal

Fixed in version 25.0.50

Done: fgallina <at> gnu.org (Fabián Ezequiel Gallina)

Bug is archived. No further changes may be made.

Full log


Message #23 received at submit <at> debbugs.gnu.org (full text, mbox):

From: fgallina <at> gnu.org (Fabián Ezequiel Gallina)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: 25.0.50; MS-Windows needs a different default for
 python-shell-interpreter-args
Date: Fri, 14 Nov 2014 04:25:01 -0300
Eli Zaretskii <eliz <at> gnu.org> writes:

> Ping!
>

Hi Eli,

Sorry for the delay but I wanted to have a Windows machine at hand to
test this.

FYI I tested this with Windows 7, Python 3.3, 3.4 and 2.7.8 and wasn't
able to replicate it.  The interpreter started without hanging.

It also worked on Windows XP With Python 2.7, so my best guess is that
this is a very especific problem that only happens with some particular
combination of Windows and Python version (I recall something similar in
an old bug).

Could you tell me those versions?

And if you are still being able to replicate this issue, does this patch
help?:

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 122f4ec..018ebd0 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -94,13 +94,16 @@
 ;;       python-shell-interpreter-args
 ;;       "-i C:\\Python27\\Scripts\\ipython-script.py")
 
-;; If you are experiencing missing or delayed output in your shells,
-;; that's likely caused by your Operating System's pipe buffering
-;; (e.g. this is known to happen running CPython 3.3.4 in Windows 7.
-;; See URL `http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17304').  To
-;; fix this, using CPython's "-u" commandline argument or setting the
+;; Hangs, missing and/or delayed output in shells were known to happen
+;; on Windows, if you are experiencing a similar behavior, that's
+;; likely caused by your Operating System's pipe buffering (e.g. this
+;; used to happen running CPython 3.3.4 in Windows 7.  See URL
+;; `http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17304').  To fix
+;; this, using CPython's "-u" commandline argument or setting the
 ;; "PYTHONUNBUFFERED" environment variable should help: See URL
-;; `https://docs.python.org/3/using/cmdline.html#cmdoption-u'.
+;; `https://docs.python.org/3/using/cmdline.html#cmdoption-u'.  For
+;; Windows "PYTHONUNBUFFERED" is set to "1" automatically by
+;; `python-shell-calculate-process-environment`.
 
 ;; The interaction relies upon having prompts for input (e.g. ">>> "
 ;; and "... " in standard Python shell) and output (e.g. "Out[1]: " in
@@ -2095,7 +2098,11 @@ uniqueness for different types of configurations."
   "Calculate process environment given `python-shell-virtualenv-root'."
   (let ((process-environment (append
                               python-shell-process-environment
-                              process-environment nil))
+                              process-environment
+                              ;; Avoid hangs on Windows out of the
+                              ;; box.  See Bug#18595 and Bug#18596.
+                              (when (eq system-type 'windows-nt)
+                                '("PYTHONUNBUFFERED=1"))))
         (virtualenv (if python-shell-virtualenv-root
                         (directory-file-name python-shell-virtualenv-root)
                       nil)))



Thanks,
Fabián





This bug report was last modified 10 years and 250 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.