Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cannot import matplotlib.animation #13786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ImportanceOfBeingErnest opened this issue Mar 28, 2019 · 2 comments · Fixed by #13787
Closed

Cannot import matplotlib.animation #13786

ImportanceOfBeingErnest opened this issue Mar 28, 2019 · 2 comments · Fixed by #13787
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Milestone

Comments

@ImportanceOfBeingErnest
Copy link
Member

Bug report

Bug summary

import matplotlib.animation fails on master with an Error (see traceback below).
This bisects to #13303 (Unify checking of executable info.)

Code for reproduction

import matplotlib.animation

Actual outcome

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "d:\path\to\development\folder\matplotlib\lib\matplotlib\animation.py", line 727, in <module>
    class ImageMagickWriter(ImageMagickBase, MovieWriter):
  File "d:\path\to\development\folder\matplotlib\lib\matplotlib\animation.py", line 120, in wrapper
    if writerClass.isAvailable():
  File "d:\path\to\development\folder\matplotlib\lib\matplotlib\animation.py", line 720, in isAvailable
    return super().isAvailable()
  File "d:\path\to\development\folder\matplotlib\lib\matplotlib\animation.py", line 417, in isAvailable
    return shutil.which(cls.bin_path()) is not None
  File "d:\path\to\development\folder\matplotlib\lib\matplotlib\animation.py", line 714, in bin_path
    binpath = mpl._get_executable_info('magick').executable
  File "d:\path\to\development\folder\matplotlib\lib\matplotlib\__init__.py", line 380, in _get_executable_info
    return impl([path, "--version"], r"^Version: ImageMagick (\S*)")
  File "d:\path\to\development\folder\matplotlib\lib\matplotlib\__init__.py", line 325, in impl
    args, stderr=subprocess.STDOUT, universal_newlines=True)
  File "D:\path\to\conda\envs\mplgit\lib\subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "D:\path\to\conda\envs\mplgit\lib\subprocess.py", line 403, in run
    with Popen(*popenargs, **kwargs) as process:
  File "D:\path\to\conda\envs\mplgit\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "D:\path\to\conda\envs\mplgit\lib\subprocess.py", line 971, in _execute_child
    args = list2cmdline(args)
  File "D:\path\to\conda\envs\mplgit\lib\subprocess.py", line 461, in list2cmdline
    needquote = (" " in arg) or ("\t" in arg) or not arg
TypeError: argument of type 'WindowsPath' is not iterable

Expected outcome

No Error

Matplotlib version

  • Operating system: Windows 8.1
  • Matplotlib version: master branch (conda environment with matplotlib in dev mode)
  • Matplotlib backend: Qt5Agg
  • Python version: 3.6.4
@ImportanceOfBeingErnest ImportanceOfBeingErnest added this to the v3.1.0 milestone Mar 28, 2019
@ImportanceOfBeingErnest ImportanceOfBeingErnest added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Mar 28, 2019
@anntzer
Copy link
Contributor

anntzer commented Mar 28, 2019

Can you confirm that

diff --git i/lib/matplotlib/__init__.py w/lib/matplotlib/__init__.py
index 80588e97a..2d2345cdf 100644
--- i/lib/matplotlib/__init__.py
+++ w/lib/matplotlib/__init__.py
@@ -363,7 +363,7 @@ def _get_executable_info(name):
                 for name in ["convert.exe", "magick.exe"]:
                     candidate = Path(binpath, name)
                     if candidate.exists():
-                        path = candidate
+                        path = str(candidate)
                         break
         else:
             path = "convert"

closes this issue? Looks like https://bugs.python.org/issue31961, basically.

@ImportanceOfBeingErnest
Copy link
Member Author

Yes, the suggested change does get rid of the error for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants