迷惑なエラーメッセージが表示されることなく、Pythonスクリプトを終了しようとしています:
Traceback (most recent call last):
File "<pyshell#27>", line 3, in <module>
sys.exit()
SystemExit
私はかなりのことを試しましたが、どれもうまくいきませんでした。次に例を示します。
while True:
print "hi", #this just tests to see if I have exited.
try:
sys.exit()
except SystemExit:
print "Exited"
注意: 解決策は、このコードに近い場所である必要はありません。これは、私が試したものの単なる例です。