Closed
Description
Bug report
I am using pyplot.ion
which turns on the interactive mode. In order to process UI events during the interactive loop, I use pyplot.pause
.
However, when quitting the interface; matplotlib uses time.sleep
without importing it anywhere, so a NameError exception is raised.
Code for reproduction
import matplotlib.pyplot as plt
plt.ion()
plt.pause(0.01)
Actual outcome
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/matplotlib/pyplot.py", line 294, in pause
time.sleep(interval)
NameError: name 'time' is not defined
Expected outcome
The program should finish gracefully. This could be fixed by adding a import time
statement inside pyplot.py
.
Matplotlib version
- Operating system: linux64
- Matplotlib version: 2.1.0
- Matplotlib backend: TkAgg
- Python version: 3.6.2