Misuse of quit() in api.py; Use of SystemExit(1) + narrow exception handling
まだ誰も着手していません。
評価
調査の方向性
face_recognition_models がインポートされ、広範な例外ハンドラーが quit() を呼び出す前にインストール手順を表示している face_recognition/api.py の 8〜13 行目付近から始めます。例外処理を絞り込み、要求どおり終了動作を置き換えます。不足している依存関係が引き続き指定されたインストールメッセージを表示し、無関係なインポートエラーを隠すことなくモジュールがステータス 1 で終了すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
In face_recognition/api.py:
- The try/except block on lines 8-13 catches a broad Exception and then calls quit. Code below:
try:
import face_recognition_models
except Exception:
print("Please install face_recognition_models with this command before using face_recognition:\n")
print("pip install git+https://github.com/ageitgey/face_recognition_models")
quit()
Using ImportError instead of except Exception can prevent masking of unrelated errors, like syntax errors, that may happen during an import. Since the block calls an import and specifically checks for missing dependencies, use of ImportError is more focused on the codes specific purpose.
For the quit() --> SystemExit(1) suggestion, quit() isn't guaranteed to exist in all execution envs. Raising SystemExit(1) is more universal and serves the same purpose, preventing any disruption in existing code. SystemExit(1) also has the benefit of not needing an import to function.
- 主要言語
- Python
- スター
- 56.8k
- フォーク
- 13.7k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ageitgey/face_recognition のほかの issue
-
CLI image-folder regex missing end-anchor picks up non-image files (foo.jpg.bak, notes.jpegdoc)対応中かも @Vic-41148 が 64 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
ageitgey/face_recognition#1678 ·
-
[Security] Automated static analysis findings for ageitgey/face_recognition (academic research)オープン
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
ageitgey/face_recognition#1681 · コメント 1 件 ·
-
Honest-Feedbackオープン
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
ageitgey/face_recognition#1669 · コメント 3 件 ·
-
AiSoulオープン
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
ageitgey/face_recognition#1668 · コメント 1 件 ·
-
Logical Error: Image display (.show()) placed inside loop, causing multiple windows for multi-face images対応中かも @pavansai018 が 318 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 55/100
ageitgey/face_recognition#1666 ·
ageitgey/face_recognition の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
CLIMADA-project/climada_python#1337 ·
メンテナーはふだん 3 日以内に返信
-
tail without reverseオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
8go/matrix-commander#233 ·
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
documentation enhancement priority:high size:M
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Validate non-divisible effective batch sizes in the Unsloth LoRA backend対応中かも @debesh-biswas が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100