Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#1,663 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
50/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
api

Research direction

Start in face_recognition/api.py around lines 8-13, where face_recognition_models is imported and the broad exception handler prints installation instructions before calling quit(). Narrow the exception handling and replace the exit behavior as requested. Done when missing dependencies still show the stated installation message and the module exits with status 1 without masking unrelated import errors.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
56.8k
Forks
13.7k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ageitgey/face_recognition

All issues in ageitgey/face_recognition

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.