* bug#21421: 24.5; python mode interpreter path problem on windows.
@ 2015-09-05 0:48 Currell Berry
2015-09-05 7:12 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Currell Berry @ 2015-09-05 0:48 UTC (permalink / raw)
To: 21421
Hello,
python-shell-parse-command in python.el appears to have an issue on
Windows
which prevents proper startup of the python interpreter depending on the
interpreter's path. Here is the current version of
python-shell-parse-command in python.el, as of Emacs 24.5.1.
(defun python-shell-parse-command () ;FIXME: why name it "parse"?
"Calculate the string used to execute the inferior Python process."
;; FIXME: process-environment doesn't seem to be used anywhere within
;; this let.
(let ((process-environment
(python-shell-calculate-process-environment))
(exec-path (python-shell-calculate-exec-path)))
(format "%s %s"
;; FIXME: Why executable-find?
(shell-quote-argument
(executable-find python-shell-interpreter))
python-shell-interpreter-args)))
The problem is with the usage of "shell-quote-argument" to quote the
pathname coming out of "executable-find".
Suppose you have python installed at "C:\Anaconda\python.exe", and
"C:\Anaconda" is on your path.
Then when we run
(executable-find python-shell-interpreter)
we get the output
"c:/Anaconda/python.exe"
This is a valid path which can be used to launch python.
However
(shell-quote-argument "c:/Anaconda/python.exe")
results in
"c\\:/Anaconda/python.exe"
This is NOT a valid windows path, as an extra backquote has been
inserted before the colon (second character).
Since python-parse-interpeter uses shell-quote-argument, you get the
following error when you run "run-python" to start up a python
interpreter.
"apply: Searching for program: no such file or directory,
c\:/Anaconda/python.exe"
If I modify Python.el to remove the call to "shell-quote-argument",
run-python works properly on my system.
Here is the value of my PATH in emacs.
(getenv "PATH")
":/usr/local/bin:/mingw/bin:/bin;C:\\Program
Files\\ImageMagick-6.9.2-Q16;C:\\windows\\system32;C:\\windows;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program
Files (x86)\\Git\\cmd;C:\\Anaconda;C:\\Program Files
(x86)\\emacs\\bin;C:\\MinGW\\bin;C:\\MinGW\\msys\\1.0;C:\\Program
Files\\gs\\gs9.09\\lib;C:\\Program Files\\gs\\gs9.09\\bin;C:\\Program
Files (x86)\\Calibre2\\;C:\\Program Files
(x86)\\Graphviz2.38\\bin;C:\\Program Files (x86)\\MiKTeX
2.9\\miktex\\bin;C:\\Users\\vancan1ty\\AppData\\Roaming\\cabal\\bin;C:\\Users\\vancan1ty\\AppData\\Roaming\\npm;C:\\Python27\\Scripts;C:\\Program
Files (x86)\\Nmap;C:\\Program Files\\Boot2Docker for
Windows;C:\\altera\\13.0sp1\\modelsim_ase\\win32aloem;C:\\Users\\vancan1ty\\AppData\\Local\\Pandoc\\"
In GNU Emacs 24.5.1 (i686-pc-mingw32)
of 2015-04-11 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --prefix=/c/usr --host=i686-pc-mingw32'
Important settings:
value of $LANG: ENU
locale-coding-system: cp1252
Major mode: Python
Minor modes in effect:
shell-dirtrack-mode: t
evil-mode: t
global-undo-tree-mode: t
undo-tree-mode: t
evil-local-mode: t
tooltip-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
C-; is undefined
Quit [2 times]
Making completion list... [4 times]
Saving file c:/Program Files
(x86)/emacs/share/emacs/24.5/lisp/progmodes/python.el...
Wrote c:/Program Files
(x86)/emacs/share/emacs/24.5/lisp/progmodes/python.el
byte-code: Beginning of buffer [2 times]
Can't guess python-indent-offset, using defaults: 4
apply: Searching for program: no such file or directory,
c\:/Anaconda/python.exe
progn: End of line [2 times]
user-error: Please specify a file name for the buffer [2 times]
byte-code: End of buffer [12 times]
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mail-utils python cua-base eieio-opt
speedbar sb-image ezimage dframe compile warnings skeleton derived pcase
rx loadhist ace-window avy vc-git json help-mode shell misearch
multi-isearch ob-dot org org-macro org-footnote org-pcomplete pcomplete
org-list org-faces org-entities noutline outline easy-mmode org-version
ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys
ob-comint comint ansi-color ob-core ob-eval org-compat org-macs
org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs
cl-macs gv server evil evil-integration undo-tree diff evil-maps
evil-commands ffap url-parse auth-source eieio byte-opt bytecomp
byte-compile cl-extra cconv eieio-core gnus-util mm-util mail-prsvr
password-cache url-vars evil-command-window evil-types evil-search
evil-ex evil-macros evil-repeat evil-states evil-core advice help-fns
evil-common windmove thingatpt rect evil-digraphs evil-vars ring edmacro
kmacro cl-loaddefs cl-lib info easymenu package epg-config 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 284198 39511)
(symbols 32 33119 0)
(miscs 32 160 697)
(strings 16 64392 15870)
(string-bytes 1 1826027)
(vectors 8 33104)
(vector-slots 4 1301156 19920)
(floats 8 112 474)
(intervals 28 2003 81)
(buffers 508 19))
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#21421: 24.5; python mode interpreter path problem on windows.
2015-09-05 0:48 bug#21421: 24.5; python mode interpreter path problem on windows Currell Berry
@ 2015-09-05 7:12 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2015-09-05 7:12 UTC (permalink / raw)
To: Currell Berry; +Cc: 21421
> From: "Currell Berry" <currellberry@gmail.com>
> Date: Sat, 05 Sep 2015 00:48:51 +0000
>
> python-shell-parse-command in python.el appears to have an issue on
> Windows which prevents proper startup of the python interpreter
> depending on the interpreter's path. Here is the current version of
> python-shell-parse-command in python.el, as of Emacs 24.5.1.
>
> (defun python-shell-parse-command () ;FIXME: why name it "parse"?
> "Calculate the string used to execute the inferior Python process."
> ;; FIXME: process-environment doesn't seem to be used anywhere within
> ;; this let.
> (let ((process-environment
> (python-shell-calculate-process-environment))
> (exec-path (python-shell-calculate-exec-path)))
> (format "%s %s"
> ;; FIXME: Why executable-find?
> (shell-quote-argument
> (executable-find python-shell-interpreter))
> python-shell-interpreter-args)))
>
> The problem is with the usage of "shell-quote-argument" to quote the
> pathname coming out of "executable-find".
>
> Suppose you have python installed at "C:\Anaconda\python.exe", and
> "C:\Anaconda" is on your path.
>
> Then when we run
> (executable-find python-shell-interpreter)
> we get the output
> "c:/Anaconda/python.exe"
> This is a valid path which can be used to launch python.
>
> However
> (shell-quote-argument "c:/Anaconda/python.exe")
> results in
> "c\\:/Anaconda/python.exe"
> This is NOT a valid windows path, as an extra backquote has been
> inserted before the colon (second character).
My crystal ball says you have w32-shell-name set to Cygwin's Bash, in
which case this is bug#20237, whose root cause is incompatibility
between Cygwin file names and native Windows file names. See
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20237#50 for more
details.
In a nutshell, setting w32-shell-name to point to Bash causes
shell-quote-argument to work differently, under the assumption that
file names are in Posix-style /foo/bar format, whereas your Python
file name is in native Windows format.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-05 7:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-05 0:48 bug#21421: 24.5; python mode interpreter path problem on windows Currell Berry
2015-09-05 7:12 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.