kelciour / movies2anki

Convert movies with subtitles to watch them with Anki. Inspired by subs2srs
GNU Affero General Public License v3.0
302 stars 28 forks source link

"TypeError: expected str, bytes or os.PathLike object, not NoneType" #15

Closed tomleary closed 3 years ago

tomleary commented 3 years ago

I can't generate cards with the movies2anki - subs2srs setting. Here's the full error message from Anki:

Error An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed. If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem. When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site. Debug info: Anki 2.1.43 (0fbae6bc) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2 Platform: Mac 10.16 Flags: frz=True ao=True sv=2 Add-ons, last update check: 2021-04-18 23:35:38 Add-ons possibly involved: ⁨Watch Foreign Language Movies with Anki⁩

Caught exception: Traceback (most recent call last): File "/Users/tom/Library/Application Support/Anki2/addons21/939347702/movies2anki.py", line 1158, in run call(cmd) File "anki/utils.py", line 278, in call File "subprocess.py", line 854, in init File "subprocess.py", line 1583, in _execute_child File "posixpath.py", line 152, in dirname TypeError: expected str, bytes or os.PathLike object, not NoneType

kelciour commented 3 years ago

Please double check that FFmpeg is installed by opening the Terminal app and typing ffmpeg. It'll probably say that command not found.

Use https://brew.sh/ to install ffmpeg and restart Anki.

brew install ffmpeg

https://trac.ffmpeg.org/wiki/CompilationGuide/macOS#ffmpegthroughHomebrew

tomleary commented 3 years ago

FFmpeg is already installed and up to date.

kelciour commented 3 years ago

This is strange. Where is it located? What which ffmpeg says in the Terminal?

Alternatively, open the Debug Console in Anki and execute these lines.

https://docs.ankiweb.net/#/misc?id=debug-console

from distutils.spawn import find_executable
print(find_executable("ffmpeg"))

For me, the output is C:\Programs\ffmpeg\bin\ffmpeg.exe

On Mac, the add-on expects ffmpeg to be located at /usr/local/bin or anywhere in the Path.

tomleary commented 3 years ago

which ffmpeg returns /opt/homebrew/bin/ffmpeg.

The debug console returns:

>>> from distutils.spawn import find_executable ... print(find_executable("ffmpeg")) None

kelciour commented 3 years ago

Thank you! Found it! The default installation path for Homebrew was changed for Apple Silicon.

This script installs Homebrew to its preferred prefix (/usr/local for macOS Intel, /opt/homebrew for Apple Silicon)

I've updated the add-on on AnkiWeb to search for ffmpeg in /opt/homebrew/bin and the issue should be fixed now. Please use Tools - Add-ons - Check for Updates to update the add-on and restart Anki.