Subject: 24.4; Bug in python.el when used in Windows OS

From: David Strip <[email-masked]>
Date: Sat, 06 Dec 2014 15:25:58 +0000

If the path to the python executable contains an embedded space, any command
that attempts to spawn a shell will fail with "invalid argument" since the
space makes the command appear to contain extra args.
In some sense, the root of the problem is locate-file, called by
executable-find (both defined in files.el). locate-file does not return quoted
paths. I'm not sure if the best fix is at the locate-files level, since I'm not
sure what consequences this might have elsewhere, esp on non-Windows OS's. The
most localized fix would be in python.el, changing python-shell-parse-command
to add the required quotes. In the simplest case, this would be just change the
format statement from

(format "%s %s"

to

(format "\"%s\" %s"

This definitely works on Windows, but I'm not certain how this would affect
other OS's. Perhaps the format string has to be conditioned on the OS.

In GNU Emacs 24.4.1 (i686-pc-mingw32)
of 2014-10-24 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --prefix=/c/usr'

Important settings:
value of $LANG: ENU
locale-coding-system: cp1252

Major mode: Fundamental

Minor modes in effect:
recentf-mode: t
tooltip-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
line-number-mode: t
transient-mark-mode: t

Recent input:
M-x r e p o r t - b u g <return>

Recent messages:
Loading d:/users/david/.recentf...done
Cleaning up the recentf list...done (0 removed)
Loading align...done
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
help-fns mail-prsvr mail-utils bs ido align recentf tree-widget wid-edit
cl-loaddefs cl-lib easymenu time-date tooltip electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp
w32-common-fns disp-table w32-win w32-vars tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process w32notify w32
multi-tty emacs)

Memory information:
((conses 8 88734 6887)
(symbols 32 18845 0)
(miscs 32 75 138)
(strings 16 15942 3714)
(string-bytes 1 444542)
(vectors 8 11233)
(vector-slots 4 397125 2824)
(floats 8 71 150)
(intervals 28 246 41)
(buffers 508 12))

--