OS X ImportError (encodings) when calling video player with python script from Kodi
#1
I'm trying to use the video player mpv with vapoursynth filter, which itself uses Python 3, as external player in the media center Kodi. mpv shortly flashes up in the Dock, then it crashes, accompanied with the error message: "mpv quit unexpectedly." and the terminal output

Code:
Opening video filter: [format fmt=yuv420p]
Opening video filter: [vapoursynth file=~/.mpv/mvtools.vpy]
Fatal Python error: Py_Initialize: unable to load the file system codec
ImportError: No module named 'encodings'

When starting mpv through the terminal or dragging a file onto it, it's all fine, no crash.

I'm using OS X 10.10.4 Yosemite and tried several versions of mpv and Kodi. I used homebrew to install Kodi, mpv, vapoursynth and python3.

The crash report: http://pastebin.com/1JLcMb6D

Other things I can provide:

Code:
$ whereis python
/usr/bin/python
(but Python 3.4 is also located in /usr/local/Cellar/python3/3.4.3/, installed with brew)

Code:
echo $PYTHONPATH
(nothing)

mpv -> vapoursynth -> fine

Kodi -> mpv -> vapoursynth -> Python error

Why does it only occur when calling it from within Kodi?
Reply
#2
In the meantime I found it out by myself:

Kodi has a built-in Python 2 interpreter and is still not using the Python 3 interpreter introduced in December 2008. Obviously the script, which needs Python 3, will not run when called from that environment. I am a little surprised that nobody was able to answer that, it should be obvious from my first sentence for everyone that knows that Kodi has built-in Python 2.
Reply
#3
It should also be obvious to anyone who reads our online documentation that Kodi doesn't use Python 3 in the first place :)
Reply

Logout Mark Read Team Forum Stats Members Help
ImportError (encodings) when calling video player with python script from Kodi0