Skip to content

[Bug]: tk backend confused by presence of file named "move" in current working directory #27400

@drmcnelson

Description

@drmcnelson

Bug summary

With a file named "move" in the current working directory, the tk backend reports that it cannot find /usr/share/matplotlib/mpl-data/images/move

Rename the local file to anything else, and everything works okay.

Code for reproduction

N/A  too large.  See the above error messages.

Actual outcome

Traceback (most recent call last):
File "/usr/lib64/python3.11/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/usr/lib64/python3.11/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/nelson/Projects/TeensyDataAcquistion/Python_Programs/GraphicsWindow.py", line 80, in animation
self.fig = plt.figure(self.name)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/site-packages/matplotlib/_api/deprecation.py", line 454, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/site-packages/matplotlib/pyplot.py", line 783, in figure
manager = new_figure_manager(
^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/site-packages/matplotlib/pyplot.py", line 359, in new_figure_manager
return _get_backend_mod().new_figure_manager(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/site-packages/matplotlib/backend_bases.py", line 3513, in new_figure_manager
return cls.new_figure_manager_given_figure(num, fig)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/site-packages/matplotlib/backend_bases.py", line 3518, in new_figure_manager_given_figure
return cls.FigureCanvas.new_manager(figure, num)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/site-packages/matplotlib/backend_bases.py", line 1703, in new_manager
return cls.manager_class.create_with_canvas(cls, figure, num)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/site-packages/matplotlib/backends/_backend_tk.py", line 481, in create_with_canvas
manager = cls(canvas, num, window)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/site-packages/matplotlib/backends/_backend_tk.py", line 431, in init
super().init(canvas, num)
File "/usr/lib64/python3.11/site-packages/matplotlib/backend_bases.py", line 2814, in init
tools.add_tools_to_container(self.toolbar)
File "/usr/lib64/python3.11/site-packages/matplotlib/backend_tools.py", line 1027, in add_tools_to_container
container.add_tool(tool, group, position)
File "/usr/lib64/python3.11/site-packages/matplotlib/backend_bases.py", line 3377, in add_tool
self.add_toolitem(tool.name, group, position,
File "/usr/lib64/python3.11/site-packages/matplotlib/backends/_backend_tk.py", line 957, in add_toolitem
button = NavigationToolbar2Tk._Button(frame, name, image_file, toggle,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/site-packages/matplotlib/backends/_backend_tk.py", line 792, in _Button
NavigationToolbar2Tk._set_image_for_button(self, b)
File "/usr/lib64/python3.11/site-packages/matplotlib/backends/_backend_tk.py", line 726, in _set_image_for_button
with Image.open(path_large if (size > 24 and path_large.exists())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/site-packages/PIL/Image.py", line 3092, in open
fp = builtins.open(filename, "rb")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/matplotlib/mpl-data/images/move'
<TextWindow.TextWindow object at 0x7f3fae9e0e10>

Expected outcome

No error messages

Additional information

The general context is a live a data acquisition system with data displayed in an animation. While there is a file named "move" in the current directory, the program produces the above error at launch.

Operating system

Fedora 37, Cinnamon desktop

Matplotlib Version

3.6.3

Matplotlib Backend

tk_agg

Python version

3.11.4

Jupyter version

n/a

Installation

Linux package manager

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions