8000 pyplot.pause doesn't import the time module but uses it (v2.1.0) · Issue #9412 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
pyplot.pause doesn't import the time module but uses it (v2.1.0) #9412
Closed
@fikisipi

Description

@fikisipi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0