When calling quit(os.EX_CONFIG)
on Windows, it gives AttributeError: module 'os' has no attribute 'EX_CONFIG'
since os.EX_CONFIG
is not compatibile with Windows (like other os's exit codes).
Is there a workaround to leave it exit with the selected code on Unix, but not raise AttributeError on unsupported systems?
Just make a condition on the platform like the following one:
if sys.platform.startswith('linux'):
quit(os.EX_CONFIG) # `os.EX_CONFIG` is only compatible with Linux
else:
quit()