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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15003 in the body.
You can then email your comments to 15003 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15003
; Package
emacs
.
(Thu, 01 Aug 2013 21:36:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
lewcreary <at> cs.com
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 01 Aug 2013 21:36:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[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)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15003
; Package
emacs
.
(Fri, 16 Aug 2013 03:59:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 15003 <at> debbugs.gnu.org (full text, mbox):
I should have mentioned that my bugfix will work only on computing
platforms on which the python executable pathname ends in ".exe" (MS
Windows, at least). The GNU maintainers will have to generalize it to
work on other platforms.
-- Lew Creary
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15003
; Package
emacs
.
(Fri, 16 Aug 2013 04:13:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 15003 <at> debbugs.gnu.org (full text, mbox):
> (run-python "c:/Program Files (x86)/Python/Python31/python.exe -i" nil t)
This is ambiguous: maybe the program you want to run is in the file
"c:/Program". Or is it "c:/Program Files"? Oh wait, maybe you meant
the executable "c:/Program Files (x86)/Python/Python31/python.exe -i"?
> ? ? ? ? (let* ((cmdlist (split-string-and-unquote cmd))
split-string-and-unquote was specifically used so that the user can
resolve those ambiguities by quoting the elements that contain
embedded spaces. E.g. try
(run-python "\"c:/Program Files (x86)/Python/Python31/python.exe\" -i" nil t)
-- Stefan
Reply sent
to
fgallina <at> gnu.org
:
You have taken responsibility.
(Mon, 02 Sep 2013 14:27:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
lewcreary <at> cs.com
:
bug acknowledged by developer.
(Mon, 02 Sep 2013 14:27:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 15003-done <at> debbugs.gnu.org (full text, mbox):
Closing this one as it is clearly a configuration thing.
Regards,
Fabián.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 01 Oct 2013 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 11 years and 258 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.