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

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

bug#20237: Emacs built on Windows cannot figure out path correctly


From: Andy Moreton
Subject: bug#20237: Emacs built on Windows cannot figure out path correctly
Date: Sat, 04 Apr 2015 15:34:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (windows-nt)

On Sat 04 Apr 2015, Eli Zaretskii wrote:

>> From: Andy Moreton <andrewjmoreton@gmail.com>
>> Date: Tue, 31 Mar 2015 23:46:23 +0100
>> 
>> On Tue 31 Mar 2015, Eli Zaretskii wrote:
>> 
>> >> Date: Tue, 31 Mar 2015 13:52:20 -0400
>> >> From: Da Zhang <zhangda82@gmail.com>
>> >> 
>> >> I am using Python mode in Emacs and wanted to start a python
>> >> sub-process.
>> >> However, Emacs could not find python.exe from the path I specified.
>> >> Particularly, the following message was displayed:
>> >> apply: Searching for program: no such file or directory,
>> >> c\:/Python27/Scripts/ipython.exeInvalid face reference: python-cell
>> >> 
>> >> It seemed a "C\:" was added in front of the path to the python.
>> >
>> > You didn't say which path of Python did you specify, and how didyou
>> > specify it.  Please tell, otherwise it's very hard to figure out the
>> > reason for the problem.
>> 
>> I have seen something similar - I think it's caused by incorrect
>> quoting:
>> 
>> --[python.el]-----------------------------------------------------------
>> (defun python-shell-calculate-command ()
>>   "Calculate the string used to execute the inferior Python process."
>>   (let ((exec-path (python-shell-calculate-exec-path)))
>>     ;; `exec-path' gets tweaked so that virtualenv's specific
>>     ;; `python-shell-interpreter' absolute path can be found by
>>     ;; `executable-find'.
>>     (format "%s %s"
>>             ;; FIXME: Why executable-find?
>>             (shell-quote-argument
>>              (executable-find python-shell-interpreter))
>>             python-shell-interpreter-args)))
>> --[python.el]-----------------------------------------------------------
>> 
>> Removing the use of shell-quote-argument seems to work around this
>> problem.
>
> I don't see why quoting here could do any harm.  Could you elaborate
> on why you think it's wrong?

Because removing the shell-quote-argument call fixed it for me:

    (when (eq system-type 'windows-nt)
      (setq python-shell-exec-path '("C:/Python27"))
      (add-function :override (symbol-function 'python-shell-calculate-command)
                    (lambda ()
                      (let ((exec-path (python-shell-calculate-exec-path)))
                        (format "%s %s"
                                (executable-find python-shell-interpreter)
                                python-shell-interpreter-args)))))







reply via email to

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