GNU bug report logs -
#15003
24.3; Function run-python fails on MS-Windows 7
Previous Next
Reported by: lewcreary <at> cs.com
Date: Thu, 1 Aug 2013 21:36:03 UTC
Severity: minor
Tags: notabug
Fixed in version 24.3
Done: fgallina <at> gnu.org
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
This bug report will be sent to the Bug-GNU-Emacs mailing list and the GNU bug tracker at debbugs.gnu.org. ?Please check that the From: line contains a valid email address. ?After a delay of up to one day, you should receive an acknowledgment at that address.
Please describe exactly what actions triggered the bug, and the precise symptoms of the bug.
----------------------------------
Emacs-version: "GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601)
?of 2013-03-17 on MARVIN" ?(a pre-compiled version for MS-Windows)
Operating System: Microsoft Windows 7 Professional (Copyright 2009)
Function-definition (from python.el):
?(defun run-python (cmd &optional dedicated show) ?... ...)
Typical invocation with Emacs running under MS-Windows 7:
?(run-python "c:/Program Files (x86)/Python/Python31/python.exe -i" nil t)
[Note- I have successfully debugged and patched the bug to be described here; the facts reported below were ascertained during the debugging process.]
This bug occurs whenever the function run-python is invoked, whether by a M-x run-python command, or by C-c C-p or <menu-bar> <Python> <Start interpreter> while editing a file in python-mode, provided that the first argument given to run-python has a pathname containing at least one space (see example invocation shown above -- this is typical when running under MS-Windows 7). When run-python is invoked under these circumstances, it fails with the error message "Spawning child process: invalid argument".
The root cause of this failure is that the space-containing command pathname in the first argument to function run-python is mangled during processing in the function python-shell-make-comint, which is called by run-python. ?This mangling occurs while processing the following line of code in python-shell-make-comint:
? ? ? ? (let* ((cmdlist (split-string-and-unquote cmd))
Since the mangling is actually done in the function split-string-and-unquote, the solution is to avoid applying split-string-and-unquote to the (possibly) space-containing command pathname. ?The successful patch I have constructed does this conservatively by changing the single line of code just displayed to be
? ? ? ? (let* ((cmdlist (list-cmd-components cmd))
where list-cmd-components is a newly written function that first extracts the (possibly) space-containing command path from the command-string while preserving it unchanged, and then calls function split-string-and-unquote on the remainder of the command-string (if any) to separate the command arguments (if any).
I've attached to this e-mail a patch file, Emacs-Bugfix.el, containing the revised definition of function python-shell-make-comint and the new definition of function list-cmd-components. ?When loaded after python.el, this patch file fixes the bug.
? -- ?Lew Creary
[Message part 2 (text/html, inline)]
[Emacs-Bugfix.el (application/octet-stream, attachment)]
This bug report was last modified 11 years and 259 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.