Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,4 @@ Creator - [Siddharth Dushantha](https://github.com/sdushantha)

[ext_pypi]: https://pypi.org/project/sherlock-project/
[ext_brew]: https://formulae.brew.sh/formula/sherlock

32 changes: 25 additions & 7 deletions sherlock_project/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,33 @@
"""

import sys
import os

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))

if __name__ == "__main__":
# Check if the user is using the correct version of Python
# First, we check the Python version so that the program gives a warning from the start if the system is incompatible.
if sys.version_info < (3, 9):
python_version = sys.version.split()[0]
print(f"Sherlock requires Python 3.9+\nYou are using Python {python_version}, which is not supported by Sherlock.")
sys.exit(1)

from sherlock_project import sherlock

if __name__ == "__main__":
# If the user did not enter any parameters or typed --gui, then start the GUI
if len(sys.argv) == 1 or "--gui" in sys.argv:
print("Starting Sherlock GUI...")

if sys.version_info < (3, 9):
print(f"Sherlock requires Python 3.9+\nYou are using Python {python_version}, which is not supported by Sherlock.")
sys.exit(1)
# To prevent PyQt from giving an error, we delete the --gui parameter that we added ourselves.
if "--gui" in sys.argv:
sys.argv.remove("--gui")

# We call the function that will launch the GUI.
# (We specifically included the import process here so as not to slow down those who only want to use the terminal.)
from sherlock_project.gui_app import run_gui
run_gui()

from sherlock_project import sherlock
sherlock.main()
else:
# We execute the original Sherlock code if the user enters standard arguments from the command line.
sys.exit(sherlock.main())

Loading