Good day,
I have tried both solutions suggested as 'similar questions', and also attempted another way of compiling the file, being
pyinstaller --onefile --console main.py
but the '--console' portion doesn't keep the console open, when the automation terminates unexpectedly. Any suggestions?
PS. Using VSCode and Python 3.11.2
Maybe you can try to put your code in try catch like
def main():
try:
....
except Exception as e:
print(f"An error occurred: {e}")
finally:
input("Press Enter to exit...")
if __name__ == "__main__":
main()