strange exceptions.SystemExit in Python 2.7 -
here code , error message, have ideas why there such exception? thanks.
source code,
import sys import tensorflow tf def main(argv): print 'in main' def f(): # method call def main(argv) try: tf.app.run() except: print "tf.app.run error ", sys.exc_info() if __name__ == "__main__": f()
error code,
in main tf.app.run error (<type 'exceptions.systemexit'>, systemexit(), <traceback object @ 0x10fa33f38>)
this expected behavior: tf.app.run()
passes result of main()
sys.exit()
(to make easier set edit code), , sys.exit()
raises exceptions.systemexit
exception.
it's important mention using tf.app.run()
completely optional. many tensorflow scripts include because more compatible google python coding style. however, if need customize logic in script, free omit tf.app.run()
. (the same applies tf.app.flags
.)
Comments
Post a Comment