AttributeError: 'NoneType' object has no attribute 'flush'

someon knows why i have that error,

Warning (from warnings module):
  File "C:\Program Files\Python36\lib\site-packages\h5py\__init__.py", line 34
    from ._conv import register_converters as _register_converters
FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
INFO:tensorflow:Restoring parameters from ./models/nlu/default/trainnlu\intent_classifier_tensorflow_embedding.ckpt
INFO:tensorflow:Restoring parameters from ./models/nlu/default/trainnlu\intent_classifier_tensorflow_embedding.ckpt

Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks: 100%|##########| 10/10 [00:00<00:00, 220.30it/s, # trackers=1]

Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=10]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=10]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=10]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=10]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=10]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=10]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=10]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=10]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=10]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=10]
Processed Story Blocks: 100%|##########| 10/10 [00:00<00:00, 121.70it/s, # trackers=10]

Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=20]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=20]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=20]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=20]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=20]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=20]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=20]
Processed Story Blocks:  70%|#######   | 7/10 [00:00<00:00, 60.82it/s, # trackers=20]
Processed Story Blocks:  70%|#######   | 7/10 [00:00<00:00, 60.82it/s, # trackers=20]
Processed Story Blocks:  70%|#######   | 7/10 [00:00<00:00, 60.82it/s, # trackers=20]
Processed Story Blocks:  70%|#######   | 7/10 [00:00<00:00, 60.82it/s, # trackers=20]
Processed Story Blocks: 100%|##########| 10/10 [00:00<00:00, 50.17it/s, # trackers=20]

Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=19]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=19]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=19]
Processed Story Blocks:  30%|###       | 3/10 [00:00<00:00, 25.97it/s, # trackers=19]
Processed Story Blocks:  30%|###       | 3/10 [00:00<00:00, 25.97it/s, # trackers=19]
Processed Story Blocks:  40%|####      | 4/10 [00:00<00:00, 15.99it/s, # trackers=19]
Processed Story Blocks:  40%|####      | 4/10 [00:00<00:00, 15.99it/s, # trackers=19]
Processed Story Blocks:  40%|####      | 4/10 [00:00<00:00, 15.99it/s, # trackers=19]
Processed Story Blocks:  40%|####      | 4/10 [00:00<00:00, 15.99it/s, # trackers=19]
Processed Story Blocks:  40%|####      | 4/10 [00:00<00:00, 15.99it/s, # trackers=19]
Processed Story Blocks:  80%|########  | 8/10 [00:00<00:00, 19.07it/s, # trackers=19]
Processed Story Blocks:  80%|########  | 8/10 [00:00<00:00, 19.07it/s, # trackers=19]
Processed Story Blocks:  80%|########  | 8/10 [00:00<00:00, 19.07it/s, # trackers=19]
Processed Story Blocks: 100%|##########| 10/10 [00:00<00:00, 23.92it/s, # trackers=19]

Processed actions: 0it [00:00, ?it/s]
Processed actions: 0it [00:00, ?it/s, # examples=1]
Processed actions: 0it [00:00, ?it/s, # examples=2]
Processed actions: 0it [00:00, ?it/s, # examples=3]
Processed actions: 0it [00:00, ?it/s, # examples=4]
Processed actions: 0it [00:00, ?it/s, # examples=5]
Processed actions: 0it [00:00, ?it/s, # examples=6]
Processed actions: 0it [00:00, ?it/s, # examples=7]
Processed actions: 0it [00:00, ?it/s, # examples=8]
Processed actions: 0it [00:00, ?it/s, # examples=9]
Processed actions: 0it [00:00, ?it/s, # examples=10]
Processed actions: 0it [00:00, ?it/s, # examples=11]
Processed actions: 0it [00:00, ?it/s, # examples=12]
Processed actions: 0it [00:00, ?it/s, # examples=13]
Processed actions: 0it [00:00, ?it/s, # examples=14]
Processed actions: 14it [00:00, 130.56it/s, # examples=14]
Processed actions: 14it [00:00, 130.56it/s, # examples=15]
Processed actions: 14it [00:00, 130.56it/s, # examples=16]
Processed actions: 14it [00:00, 130.56it/s, # examples=17]
Processed actions: 14it [00:00, 130.56it/s, # examples=18]
Processed actions: 14it [00:00, 130.56it/s, # examples=19]
Processed actions: 14it [00:00, 130.56it/s, # examples=20]
Processed actions: 14it [00:00, 130.56it/s, # examples=21]
Processed actions: 14it [00:00, 130.56it/s, # examples=22]
Processed actions: 22it [00:00, 108.86it/s, # examples=22]
Processed actions: 22it [00:00, 108.86it/s, # examples=23]
Processed actions: 22it [00:00, 108.86it/s, # examples=24]
Processed actions: 22it [00:00, 108.86it/s, # examples=25]
Processed actions: 22it [00:00, 108.86it/s, # examples=26]
Processed actions: 22it [00:00, 108.86it/s, # examples=27]
Processed actions: 22it [00:00, 108.86it/s, # examples=28]
Processed actions: 22it [00:00, 108.86it/s, # examples=29]
Processed actions: 29it [00:00, 86.92it/s, # examples=29] 
Processed actions: 29it [00:00, 86.92it/s, # examples=30]
Processed actions: 29it [00:00, 86.92it/s, # examples=31]
Processed actions: 29it [00:00, 86.92it/s, # examples=32]
Processed actions: 29it [00:00, 86.92it/s, # examples=33]
Processed actions: 29it [00:00, 86.92it/s, # examples=34]
Processed actions: 29it [00:00, 86.92it/s, # examples=35]
Processed actions: 35it [00:00, 73.75it/s, # examples=35]
Processed actions: 35it [00:00, 73.75it/s, # examples=36]
Processed actions: 35it [00:00, 73.75it/s, # examples=37]
Processed actions: 35it [00:00, 73.75it/s, # examples=38]
Processed actions: 35it [00:00, 73.75it/s, # examples=39]
Processed actions: 35it [00:00, 73.75it/s, # examples=40]
Processed actions: 35it [00:00, 73.75it/s, # examples=41]
Processed actions: 41it [00:00, 57.68it/s, # examples=41]
Processed actions: 41it [00:00, 57.68it/s, # examples=42]
Processed actions: 41it [00:00, 57.68it/s, # examples=43]
Processed actions: 41it [00:00, 57.68it/s, # examples=44]
Processed actions: 41it [00:00, 57.68it/s, # examples=45]
Processed actions: 41it [00:00, 57.68it/s, # examples=46]
Processed actions: 46it [00:00, 48.92it/s, # examples=46]
Processed actions: 46it [00:00, 48.92it/s, # examples=47]
Processed actions: 46it [00:00, 48.92it/s, # examples=48]
Processed actions: 46it [00:00, 48.92it/s, # examples=49]
Processed actions: 46it [00:00, 48.92it/s, # examples=50]
Processed actions: 46it [00:00, 48.92it/s, # examples=51]
Processed actions: 51it [00:00, 40.31it/s, # examples=51]
Processed actions: 51it [00:00, 40.31it/s, # examples=52]
Processed actions: 51it [00:00, 40.31it/s, # examples=53]
Processed actions: 51it [00:00, 40.31it/s, # examples=54]
Processed actions: 51it [00:01, 40.31it/s, # examples=55]
Processed actions: 51it [00:01, 40.31it/s, # examples=56]
Processed actions: 56it [00:01, 35.94it/s, # examples=56]
Processed actions: 56it [00:01, 35.94it/s, # examples=57]
Processed actions: 56it [00:01, 35.94it/s, # examples=58]
Processed actions: 56it [00:01, 35.94it/s, # examples=59]
Processed actions: 56it [00:01, 35.94it/s, # examples=60]
Processed actions: 60it [00:01, 31.56it/s, # examples=60]
Processed actions: 60it [00:01, 31.56it/s, # examples=61]
Processed actions: 60it [00:01, 31.56it/s, # examples=62]
Processed actions: 60it [00:01, 31.56it/s, # examples=63]
Processed actions: 60it [00:01, 31.56it/s, # examples=64]
Processed actions: 64it [00:01, 30.38it/s, # examples=64]
Processed actions: 64it [00:01, 30.38it/s, # examples=65]
Processed actions: 64it [00:01, 30.38it/s, # examples=66]
Processed actions: 64it [00:01, 30.38it/s, # examples=67]
Processed actions: 64it [00:01, 30.38it/s, # examples=68]
Processed actions: 68it [00:01, 28.16it/s, # examples=68]
Processed actions: 68it [00:01, 28.16it/s, # examples=69]
Processed actions: 68it [00:01, 28.16it/s, # examples=70]
Processed actions: 68it [00:01, 28.16it/s, # examples=71]
Processed actions: 71it [00:01, 26.21it/s, # examples=71]
Processed actions: 71it [00:01, 26.21it/s, # examples=72]
Processed actions: 71it [00:01, 26.21it/s, # examples=73]
Processed actions: 71it [00:01, 26.21it/s, # examples=74]
Processed actions: 74it [00:01, 23.93it/s, # examples=74]
Processed actions: 74it [00:01, 23.93it/s, # examples=75]
Processed actions: 74it [00:01, 23.93it/s, # examples=76]
Processed actions: 74it [00:01, 23.93it/s, # examples=77]
Processed actions: 77it [00:01, 24.59it/s, # examples=77]
Processed actions: 77it [00:02, 24.59it/s, # examples=78]
Processed actions: 77it [00:02, 24.59it/s, # examples=79]
Processed actions: 77it [00:02, 24.59it/s, # examples=80]
Processed actions: 80it [00:02, 22.88it/s, # examples=80]
Processed actions: 80it [00:02, 22.88it/s, # examples=81]
Processed actions: 80it [00:02, 22.88it/s, # examples=82]
Processed actions: 80it [00:02, 22.88it/s, # examples=83]
Processed actions: 83it [00:02, 21.37it/s, # examples=83]
Processed actions: 83it [00:02, 21.37it/s, # examples=84]
Processed actions: 83it [00:02, 21.37it/s, # examples=85]
Processed actions: 83it [00:02, 21.37it/s, # examples=86]
Processed actions: 86it [00:02, 20.84it/s, # examples=86]
Processed actions: 86it [00:02, 20.84it/s, # examples=87]
Processed actions: 86it [00:02, 20.84it/s, # examples=88]
Processed actions: 86it [00:02, 20.84it/s, # examples=89]
Processed actions: 89it [00:02, 19.90it/s, # examples=89]
Processed actions: 89it [00:02, 19.90it/s, # examples=90]
Processed actions: 89it [00:02, 19.90it/s, # examples=91]
Processed actions: 89it [00:02, 19.90it/s, # examples=92]
Processed actions: 92it [00:02, 19.30it/s, # examples=92]
Processed actions: 92it [00:02, 19.30it/s, # examples=93]
Processed actions: 92it [00:02, 19.30it/s, # examples=94]
Processed actions: 94it [00:02, 18.62it/s, # examples=94]
Processed actions: 94it [00:02, 18.62it/s, # examples=95]
Processed actions: 94it [00:02, 18.62it/s, # examples=96]
Processed actions: 96it [00:03, 17.21it/s, # examples=96]
Processed actions: 96it [00:03, 17.21it/s, # examples=97]
Processed actions: 96it [00:03, 17.21it/s, # examples=98]
Processed actions: 98it [00:03, 16.50it/s, # examples=98]
Processed actions: 98it [00:03, 16.50it/s, # examples=99]
Processed actions: 98it [00:03, 16.50it/s, # examples=100]
Processed actions: 100it [00:03, 14.87it/s, # examples=100]
Processed actions: 100it [00:03, 14.87it/s, # examples=101]
Processed actions: 100it [00:03, 14.87it/s, # examples=102]
Processed actions: 102it [00:03, 14.95it/s, # examples=102]
Processed actions: 102it [00:03, 14.95it/s, # examples=103]
Processed actions: 102it [00:03, 14.95it/s, # examples=104]
Processed actions: 104it [00:03, 14.42it/s, # examples=104]
Processed actions: 104it [00:03, 14.42it/s, # examples=105]
Processed actions: 104it [00:03, 14.42it/s, # examples=106]
Processed actions: 106it [00:03, 14.03it/s, # examples=106]
Processed actions: 106it [00:03, 14.03it/s, # examples=107]
Processed actions: 106it [00:03, 14.03it/s, # examples=108]
Processed actions: 108it [00:03, 12.95it/s, # examples=108]
Processed actions: 108it [00:03, 12.95it/s, # examples=109]
Processed actions: 108it [00:04, 12.95it/s, # examples=110]
Processed actions: 110it [00:04, 13.04it/s, # examples=110]
Processed actions: 110it [00:04, 13.04it/s, # examples=111]
Processed actions: 110it [00:04, 13.04it/s, # examples=112]
Processed actions: 112it [00:04, 13.11it/s, # examples=112]
Processed actions: 112it [00:04, 13.11it/s, # examples=113]
Processed actions: 112it [00:04, 13.11it/s, # examples=114]
Processed actions: 114it [00:04, 12.84it/s, # examples=114]
Processed actions: 114it [00:04, 12.84it/s, # examples=115]
Processed actions: 114it [00:04, 12.84it/s, # examples=116]
Processed actions: 116it [00:04, 11.83it/s, # examples=116]
Processed actions: 116it [00:04, 11.83it/s, # examples=117]
Processed actions: 116it [00:04, 11.83it/s, # examples=118]
Processed actions: 118it [00:04, 12.24it/s, # examples=118]
Processed actions: 118it [00:04, 12.24it/s, # examples=119]
Processed actions: 118it [00:04, 12.24it/s, # examples=120]
Processed actions: 120it [00:04, 11.79it/s, # examples=120]
Processed actions: 120it [00:04, 11.79it/s, # examples=121]
Processed actions: 120it [00:05, 11.79it/s, # examples=122]
Processed actions: 122it [00:05, 11.79it/s, # examples=122]
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
masking (Masking)            (None, 3, 69)             0         
_________________________________________________________________
lstm (LSTM)                  (None, 32)                13056     
_________________________________________________________________
dense (Dense)                (None, 19)                627       
_________________________________________________________________
activation (Activation)      (None, 19)                0         
=================================================================
Total params: 13,683
Trainable params: 13,683
Non-trainable params: 0
_________________________________________________________________
INFO:rasa_core.policies.keras_policy:Fitting model with 222 total samples and a validation split of 0.1
Epoch 1/3

 50/222 [=====>........................] - ETA: 3s - loss: 2.9404 - acc: 0.0800
100/222 [============>.................] - ETA: 1s - loss: 2.9395 - acc: 0.0700
150/222 [===================>..........] - ETA: 0s - loss: 2.9420 - acc: 0.0733
200/222 [==========================>...] - ETA: 0s - loss: 2.9360 - acc: 0.1050
222/222 [==============================] - 1s 6ms/step - loss: 2.9330 - acc: 0.1126
Epoch 2/3

 50/222 [=====>........................] - ETA: 0s - loss: 2.8871 - acc: 0.3800
222/222 [==============================] - 0s 76us/step - loss: 2.8842 - acc: 0.3559
Epoch 3/3

 50/222 [=====>........................] - ETA: 0s - loss: 2.8472 - acc: 0.3400
222/222 [==============================] - 0s 100us/step - loss: 2.8473 - acc: 0.3784
INFO:rasa_core.policies.keras_policy:Done fitting keras policy model
INFO:rasa_core.training.interactive:Rasa Core server is up and running on http://localhost:5005
e[92mBot loaded. Visualisation at http://localhost:5005/visualization.html.
Type a message and press enter (press 'Ctr-c' to exit). e[0m

Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks:   0%|          | 0/10 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks:  60%|######    | 6/10 [00:00<00:00, 59.81it/s, # trackers=1]
Processed Story Blocks:  60%|######    | 6/10 [00:00<00:00, 59.81it/s, # trackers=1]
Processed Story Blocks:  60%|######    | 6/10 [00:00<00:00, 59.81it/s, # trackers=1]
Processed Story Blocks:  60%|######    | 6/10 [00:00<00:00, 59.81it/s, # trackers=1]
Processed Story Blocks:  60%|######    | 6/10 [00:00<00:00, 59.81it/s, # trackers=1]
Processed Story Blocks: 100%|##########| 10/10 [00:00<00:00, 56.91it/s, # trackers=1]
ERROR:rasa_core.training.interactive:An exception occurred while recording messages.
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\eventloop\context.py", line 88, in get
    return self._storage[ctx]
KeyError: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\output\defaults.py", line 52, in get_default_output
    value = _default_output.get()
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\eventloop\context.py", line 90, in get
    raise TaskLocalNotSetError
prompt_toolkit.eventloop.context.TaskLocalNotSetError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\rasa_core\training\interactive.py", line 1216, in record_messages
    _enter_user_message(sender_id, endpoint)
  File "C:\Program Files\Python36\lib\site-packages\rasa_core\training\interactive.py", line 1063, in _enter_user_message
    question = questionary.text("Next user input (Ctr-c to abort):")
  File "C:\Program Files\Python36\lib\site-packages\questionary\prompts\text.py", line 62, in text
    **kwargs)
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\shortcuts\prompt.py", line 285, in __init__
    output = output or get_default_output()
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\output\defaults.py", line 61, in get_default_output
    return create_output()
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\output\defaults.py", line 35, in create_output
    return Win32Output(stdout)
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\output\win32.py", line 83, in __init__
    info = self.get_win32_screen_buffer_info()
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\output\win32.py", line 168, in get_win32_screen_buffer_info
    self.flush()
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\output\win32.py", line 296, in flush
    self.stdout.flush()
AttributeError: 'NoneType' object has no attribute 'flush'
Exception in thread Thread-7:
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\eventloop\context.py", line 88, in get
    return self._storage[ctx]
KeyError: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\output\defaults.py", line 52, in get_default_output
    value = _default_output.get()
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\eventloop\context.py", line 90, in get
    raise TaskLocalNotSetError
prompt_toolkit.eventloop.context.TaskLocalNotSetError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\Program Files\Python36\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Program Files\Python36\lib\site-packages\rasa_core\training\interactive.py", line 1216, in record_messages
    _enter_user_message(sender_id, endpoint)
  File "C:\Program Files\Python36\lib\site-packages\rasa_core\training\interactive.py", line 1063, in _enter_user_message
    question = questionary.text("Next user input (Ctr-c to abort):")
  File "C:\Program Files\Python36\lib\site-packages\questionary\prompts\text.py", line 62, in text
    **kwargs)
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\shortcuts\prompt.py", line 285, in __init__
    output = output or get_default_output()
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\output\defaults.py", line 61, in get_default_output
    return create_output()
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\output\defaults.py", line 35, in create_output
    return Win32Output(stdout)
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\output\win32.py", line 83, in __init__
    info = self.get_win32_screen_buffer_info()
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\output\win32.py", line 168, in get_win32_screen_buffer_info
    self.flush()
  File "C:\Program Files\Python36\lib\site-packages\prompt_toolkit\output\win32.py", line 296, in flush
    self.stdout.flush()
AttributeError: 'NoneType' object has no attribute 'flush'

This sounds like you are not running in a proper shell. Where are you running this from?