Search code examples
python-3.xtensorflowsystemexit

TensorFlow. When running fully_connected_feed.py, app.py occus a 'systemexit' error


I was just learning 'TensorFlow Mechanics 101'. Error occurred when I run fully_connected_feed.py for trainning the MNIST data:

Step 1800: loss = 0.30 (0.002 sec)
Step 1900: loss = 0.44 (0.003 sec)
Training Data Eval:
  Num examples: 55000  Num correct: 49180  Precision @ 1: 0.8942
Validation Data Eval:
  Num examples: 5000  Num correct: 4509  Precision @ 1: 0.9018
Test Data Eval:
  Num examples: 10000  Num correct: 9023  Precision @ 1: 0.9023
An exception has occurred, use %tb to see the full traceback.

SystemExit

D:\software\anaconda\envs\tensorflow\lib\site-packages\IPython\core\interactiveshell.py:2870: 
UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
  warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)

After I typed '%tb', it shows:

%tb
Traceback (most recent call last):

  File "<ipython-input-1-984b11309266>", line 1, in <module>
    runfile('D:/wangjc/pythonTest/TensorFlow/testTensorFlow.py', wdir='D:/wangjc/pythonTest/TensorFlow')

  File "D:\software\anaconda\envs\tensorflow\lib\site-packages\spyder\utils\site\sitecustomize.py", line 707, in runfile
    execfile(filename, namespace)

  File "D:\software\anaconda\envs\tensorflow\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "D:/wangjc/pythonTest/TensorFlow/testTensorFlow.py", line 277, in <module>
    tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)

  File "D:\software\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))

SystemExit

I have found a question like me, but actually it is not the same problem as me. This error message shows different from me:

TypeError: run() got an unexpected keyword argument 'argv'

Also, I installed TensorFlow 1.1.0 by'pip install'.

And, I tried to use several kinds of 'fully_connected_feed.py' code in different TensorFlow version, but other err ( if using lower version ) or the same err occurs.

Some people says the 'SystemExit' error occurs because there is a CMD thread problem. But I don't know whether it is the root and where it is.

Please help me to solve this problem. Thanks!

My ide environment is:

  1. windows 10
  2. Anaconda Python 3.5
  3. TensorFlow 1.1.0
  4. TensorFlow was installed by this code: (tensorflow) wangjc@wangjc-Inspiron-3668:~$ pip install --ignore-installed --upgrade https://xxxxxxxx.whl

The version shows below:

import tensorflow as tf

tf.VERSION
Out[4]: '1.1.0'

Solution

  • From your traceback:

    _sys.exit(main(_sys.argv[:1] + flags_passthrough))

    the call to main is wrapped inside a _sys.exit() call that kills the quits the program once it has finished. The message you get comes from running the file inside an iPython iteractive shell. sys.exit() raises a SystemExit exception that normally is used to quit python. iPython's shell, however, captures that exception and shows it to you with a warning. This, however, does not affect your program. Just ignore the message or remove the _sys.exit() wrapping the call to main() in your script.