all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Augusto Stoffel <arstoffel@gmail.com>
To: Matthias Meulien <orontee@gmail.com>
Cc: 64406@debbugs.gnu.org
Subject: bug#64406: [PATCH] Improve commands to manage Python imports
Date: Fri, 07 Jul 2023 19:02:27 +0200	[thread overview]
Message-ID: <87pm534puk.fsf@gmail.com> (raw)
In-Reply-To: <874jmnbd5v.fsf@gmail.com> (Matthias Meulien's message of "Sat, 01 Jul 2023 22:16:28 +0200")

On Sat,  1 Jul 2023 at 22:16, Matthias Meulien wrote:

> -from sys import argv, stdin
> +from sys import argv, exit, stdin

FWIW, exit is already in the global namespace.

> -        (unless (eq 0 status)
> +        (cond
> +         ((eq 1 status)
>            (error "%s exited with status %s (maybe isort is missing?)"
>                   python-interpreter status))
> +         ((eq 2 status)
> +          (error "%s exited with status %s (maybe isort version is <5.7.0?)"
> +                 python-interpreter status)))

This change implies that the "success" branch may run if the exit code
is nonzero (without knowing all the isort internals, it can't be
excluded that an exit code > 2 is used somewhere).  I suggest instead a
(pcase status ...) to construct the " (maybe... ?)" segment of the error
message.

We could also take this opportunity to distinguish between random
exceptions happening in the script (which likely leads to exit code 1)
and the ModuleNotFoundError case.





  parent reply	other threads:[~2023-07-07 17:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-01 20:16 bug#64406: [PATCH] Improve commands to manage Python imports Matthias Meulien
2023-07-06  7:28 ` Eli Zaretskii
2023-07-07 17:02 ` Augusto Stoffel [this message]
2023-07-07 17:46   ` Matthias Meulien
2023-07-09  6:09     ` Matthias Meulien
2023-07-09  6:32       ` Matthias Meulien
2023-07-09  7:28         ` Eli Zaretskii
2023-07-09  7:54           ` Matthias Meulien
2023-07-13  6:07       ` Eli Zaretskii
2023-07-13 21:07         ` Matthias Meulien
2023-07-15  8:25           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pm534puk.fsf@gmail.com \
    --to=arstoffel@gmail.com \
    --cc=64406@debbugs.gnu.org \
    --cc=orontee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.