imageio / imageio-ffmpeg

FFMPEG wrapper for Python
BSD 2-Clause "Simplified" License
221 stars 50 forks source link

Calling `imageio_ffmpeg.get_ffmpeg_exe()` under CygWin raises an exception #26

Closed dspinellis closed 4 years ago

dspinellis commented 4 years ago

Calling imageio_ffmpeg.get_ffmpeg_exe() under CygWin raises an exception.

$ python3
Python 3.6.8 (default, Feb 14 2019, 22:09:48)
[GCC 7.4.0] on cygwin
>>> import imageio_ffmpeg
>>> imageio_ffmpeg.get_ffmpeg_exe()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/site-packages/imageio_ffmpeg/_utils.py", line 36, in get_ffmpeg_exe
    if plat.startswith("win"):
AttributeError: 'NoneType' object has no attribute 'startswith'
>>>

The get_platform function, which is used to set plat, seems to work fine with a normal import.

>>> import sysconfig
>>> sysconfig.get_platform()
'cygwin-3.0.6-x86_64'
almarklein commented 4 years ago

Thanks for the report!

The plat is obtained by get_platform() from _definitions.py, which uses sys.platform. What is sys.platform on CygWin?

I don't have CygWin installed at the moment. A pull request would be very welcome.

The code using get_platform() is contained in get_ffmpeg_exe(), where plat is used to select the exe to use. Should this be the Windows .exe? If so, then we should make get_platform() return win on CygWin as well, and that should be it.

almarklein commented 4 years ago

Fixed by #27