sys.exit() will do exactly what you want.
import sys
sys.exit("Error message")
More Related Contents:
- Pandas: Adding new column to dataframe which is a copy of the index column
- How do I read text from the clipboard?
- Play a Sound with Python [duplicate]
- Non-alphanumeric list order from os.listdir()
- How do I disable log messages from the Requests library?
- DLL load failed error when importing cv2
- How to test the membership of multiple values in a list?
- Python strftime – date without leading 0?
- How to write to a file, using the logging Python module?
- Log output of multiprocessing.Process
- Using self.xxxx as a default parameter – Python
- In Python, how can I put a thread to sleep until a specific time?
- What could cause a python module to be imported twice?
- How to get Windows’ special folders for currently logged-in user?
- Making an API call in Python with an API that requires a bearer token
- Getting TypeError: __init__() missing 1 required positional argument: ‘on_delete’ when trying to add parent table after child table with entries
- How to set the timezone in Django
- Precision lost while using read_csv in pandas
- “is” operator result: What is happening? [duplicate]
- OSError: Initializing from file failed on csv in Pandas
- Discord.py-rewrite wait_for() how do i use?
- openpyxl – adjust column width size
- Can’t install PIL after Mac OS X 10.9
- Where does flask look for image files?
- Datetime conversion – How to extract the inferred format?
- How to get rows which match a list of 3-tuples conditions with SQLAlchemy
- Python modules with identical names (i.e., reusing standard module names in packages)
- How to get list of all variables in jinja 2 templates
- Numpy array broadcasting rules
- Drop row in pandas dataframe if any value in the row equals zero