bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18596: 25.0.50; MS-Windows needs a different default for python-shel


From: Fabián Ezequiel Gallina
Subject: bug#18596: 25.0.50; MS-Windows needs a different default for python-shell-interpreter-args
Date: Fri, 14 Nov 2014 04:25:01 -0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Eli Zaretskii <eliz@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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]