Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Misuse of quit() in api.py; Use of SystemExit(1) + narrow exception handling

オープン
#1,663 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1〜3時間
初心者へのやさしさ
50/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
api

調査の方向性

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 はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ageitgey/face_recognition のほかの issue

ageitgey/face_recognition の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。