GNU bug report logs - #45655
Please use 'python3' command instead of 'python'

Previous Next

Package: emacs;

Reported by: Balint Reczey <balint.reczey <at> canonical.com>

Date: Mon, 4 Jan 2021 15:50:02 UTC

Severity: normal

Tags: fixed

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 45655 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Balint Reczey <balint.reczey <at> canonical.com>
Cc: 45655 <at> debbugs.gnu.org
Subject: Re: bug#45655: Please use 'python3' command instead of 'python'
Date: Wed, 06 Jan 2021 11:59:28 -0500
Balint Reczey wrote:

> Python 2 reached EOL about a year ago thus the 'python' command may be
> missing on some systems. 'python3' is the standard way of invoking the
> Python 3 interpreter, thus Emacs would have a better chance trying
> that.
>
> The attached patch is already carried in Ubuntu.

Thanks for the report.

> --- a/lisp/ldefs-boot.el
> +++ b/lisp/ldefs-boot.el
> @@ -26539,7 +26539,7 @@
>  
>  (add-to-list 'interpreter-mode-alist (cons (purecopy "python[0-9.]*") 'python-mode))
>  
> -(autoload 'run-python "python" "\
> +(autoload 'run-python "python3" "\

This bit is wrong. Firstly, ldefs-boot is a generated file, and
secondly, unless Ubuntu is distributing a python3.el, it would just
break the autoload.

> --- a/lisp/progmodes/python.el
> +++ b/lisp/progmodes/python.el
> @@ -1952,7 +1952,7 @@
>    :group 'python
>    :safe 'stringp)
>  
> -(defcustom python-shell-interpreter "python"
> +(defcustom python-shell-interpreter "python3"

(if (executable-find "python3") "python3" "python")

is probably how Emacs would normally handle this kind of thing.
Or if defaulting to python3 is better (I guess it is):

(cond ((executable-find "python3") "python3")
      ((executable-find "python") "python")
      (t "python3"))




This bug report was last modified 4 years and 188 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.