0 and 1 are the exit codes.

exit(0) means a clean exit without any errors / problems

exit(1) means there was some issue / error / problem and that is why the program is exiting.

This is not Python specific and is pretty common. A non-zero exit code is treated as an abnormal exit, and at times, the error code indicates what the problem was. A zero error code means a successful exit.

This is useful for other programs, shell, caller etc. to know what happened with your program and proceed accordingly.

Answer from manojlds on Stack Overflow
🌐
Reddit
reddit.com › r/pycharm › when i run my (beginner) program it says: process finished with exit code 0, what does that mean?
r/pycharm on Reddit: When I run my (beginner) program it says: Process finished with exit code 0, what does that mean?
May 23, 2021 - If you don’t give your program an exit code with the line exit(0) explicitly, and nothing in your program terminated abnormally, then the default return value for your program will be 0.
Discussions

What does "script xyz.py returned exit code 0" mean in Python? - Stack Overflow
I got a message saying script xyz.py returned exit code 0. What does this mean? What do the exit codes in Python mean? How many are there? Which ones are important? More on stackoverflow.com
🌐 stackoverflow.com
Def (main) function not showing output. Process finished with exit code 0
I am viewing a video wherein the trainer runs this code as it is and get the result. I’m a newbie to python and when i replicate the same I don’t see any out. All I see in my Console is “Process finished with exit code 0… More on discuss.python.org
🌐 discuss.python.org
5
0
January 30, 2025
python - PyCharm: Process finished with exit code 0 - Stack Overflow
I am new to PyCharm and I have 'Process finished with exit code 0' instead of getting (683, 11) as a result (please see attachment), could you guys help me out please? Much appreciate it! More on stackoverflow.com
🌐 stackoverflow.com
Code 0 1 in python
I am trying to add the return code and getting error message. if os.stat(file).st.size == 0: return 0 else: return 1 More on discuss.python.org
🌐 discuss.python.org
9
0
May 17, 2023
🌐
Notes
henryleach.com › 2025 › 02 › controlling-python-exit-codes-and-shell-scripts
Controlling Python Exit Codes and Shell Scripts - Henry Leach
February 9, 2025 - Also note that some programs, like grep(1) exit 0 only when something has been found, 1 when nothing has been found (but this doesn't mean an error) and >1 when there has been an error2. If you choose to try and make the error codes to your program mean something (and document this!) then you can use it in more complex scripts like: #!/bin/sh eval python exit-examples.py return_code=$? if [ $return_code = 0 ]; then echo "Success!" elif [ $return_code = 1 ]; then echo "Mild panic!" elif [ $return_code = 42 ]; then echo "Other fallback" else echo "Real Failure" exit $return_code fi
🌐
Quora
quora.com › What-is-the-exit-status-code-of-a-Python-script
What is the exit status code of a Python script? - Quora
By default, if your script runs without any issues, it will have an exit code of 0 (zero), which indicates success . The exit codes only have meaning as assigned by the script author.
🌐
Sololearn
sololearn.com › en › Discuss › 2260291 › what-does-program-finished-with-exit-code-0-mean-in-python-
What does ... program finished with exit code 0 mean in python ? | Sololearn: Learn to code for FREE!
That will occur when your code have successfully exited without any errors.. Actually it is - 0 for successful execution of code & 1 for unsuccessful execution of code.
🌐
Josip Miskovic
josipmisko.com › posts › process-finished-with-exit-code-0
Process finished with exit code 0: What does it mean? – Josip Miskovic
March 9, 2023 - Don't worry, if you get a “Process finished with exit code 0” message, that means that the code ran correctly.
Find elsewhere
🌐
Cisco
orbital.amp.cisco.com › help › Content › Topics › Script-Exit-Codes.htm
Script Exit Codes - Orbital
Script exit codes inform Orbital whether a Python script completed successfully. Scripts return an exit code using the sys.exit() function. A zero (0) will be returned if the script completes successfully. A non-zero exit code will be returned if the script fails.
🌐
Delft Stack
delftstack.com › home › howto › python › process finished with exit code
How to Process Finished With Exit Code 0 in Python | Delft Stack
February 2, 2024 - The range of exit codes varies across operating systems, but the convention is to use 0 to indicate successful termination and any nonzero value (often 1) to denote an error or abnormal termination.
🌐
PsychoPy
discourse.psychopy.org › builder
What to do to avoid exit code 0? - Builder - PsychoPy
June 7, 2024 - I have a problem with running an experiment and don’t know how to solve it. I’d appreciate any help! OS (e.g. Win10): Win11 PsychoPy version (e.g. 1.84.x): 2023.1.1 What are you trying to achieve?: I’m trying to run an experiment which I haven’t programmed myself but whenever I click ‘run’ the screen goes grey for a few seconds followed by an error (exit code 0). I have no idea how to make this work.
🌐
Reddit
reddit.com › r/learnprogramming › python always displaying exit code 0
r/learnprogramming on Reddit: Python always displaying exit code 0
October 20, 2023 -

Hi, so i'm mostly new to coding and i have an initial test for a course this sunday. I'm using Python for it and what i wanna ask is, why does the "Process finished with exit code 0" message get displayed when there are certainly lots of issues with the code that even i as a noob can see? It often also comes without an output. I can place a single example, but it happens damn near every time.

Top answer
1 of 2
2
That message isn't coming from your program or from the Python interpreter. It's coming from whatever you're using to run your program, such as an IDE. Every process has an exit code when it terminates. By convention, a code of 0 means "success" or "normal termination". Even if there are "issues" with your code, it will exit with code 0 if it terminates normally (which means not throwing an uncaught exception or explicitly calling sys.exit). If your program is throwing an exception, but you're still seeing "exit code 0", then that indicates a bug or misconfiguration with however your program is being invoked. For instance, if your IDE is running a shell script which in turn runs the Python interpreter, then the shell script might exit normally even if the Python interpreter fails.
2 of 2
1
On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge. If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options: Limiting your involvement with Reddit, or Temporarily refraining from using Reddit Cancelling your subscription of Reddit Premium as a way to voice your protest. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
🌐
Finxter
blog.finxter.com › home › learn python blog › what’s the difference between exit(0) and exit(1) in python?
What's the Difference Between exit(0) and exit(1) in Python? - Be on the Right Side of Change
September 25, 2021 - The non-zero exit code can be anything ranging from 1-255 indicating unsuccessful execution of a program. 0 is the default exit code used by python treated as the successful execution of a program.
🌐
OpenAI Developer Community
community.openai.com › api
NO RESULTS: Python Script showing "Process finished with exit code 0" but shows no results - API - OpenAI Developer Community
October 13, 2022 - Hi everyone, I am running a simple Python script using the OpenAI API to correct a spelling mistake in a sentence in PyCharm using Python v3.10, the problem is it shows that the “Process finished with exit code 0” but nothing shows up! It works perfectly fine in the OpenAI Playground, but doesn’t work in my instance.
🌐
Linux Hint
linuxhint.com › python-exit-codes
Python Exit Codes – Linux Hint
Python has only two standard codes, i.e., a one and a zero. The exit code of 0 means that the process has been executed and exited successfully. This means no error was encountered. On the other hand, an error code of 1 indicates that the process exited with a failure.
🌐
Python Morsels
pythonmorsels.com › exiting-a-python-program
Exiting a Python program - Python Morsels
February 21, 2022 - To exit a Python program early, call sys.exit with 0 for success, 1 for error, or a string (to print an error message while exiting).
🌐
freeCodeCamp
freecodecamp.org › news › python-exit-how-to-use-an-exit-function-in-python-to-stop-a-program
Python Exit – How to Use an Exit Function in Python to Stop a Program
June 5, 2023 - You can pass an optional exit status code as an argument to the function, indicating the reason for termination. Again, a status code of 0 is typically used to indicate successful program completion, while non-zero values represent different ...