python-mpv
python-mpv copied to clipboard
Cannot find mpv-1.dll
trafficstars
Operating System: Windows 10 Home (1909) Python Version: 3.8 MPV Version: 0.45
Description
Cannot find mpv-1.dll but the file is in the same directory of the script.
Folder structure
- vvvvid_downloader
-- mpv.py
-- mpv-1.dll
-- test_mpv.py
Code
# test_mpv.py
url = "https://example.com/vod.m3u8"
player = MPV(osc=True)
player.play(url)
player.wait_for_playback()
player.terminate()
Traceback
Traceback (most recent call last):
File "test_mpv.py", line 2, in <module>
from mpv import MPV
File "E:\GitHub Workspace\vvvvid-downloader\vvvvid_downloader\mpv.py", line 33, in <module>
raise OSError('Cannot find mpv-1.dll in your system %PATH%. One way to deal with this is to ship mpv-1.dll '
OSError: Cannot find mpv-1.dll in your system %PATH%. One way to deal with this is to ship mpv-1.dll with your script and put the directory your script is in into %PATH% before "import mpv": os.environ["PATH"] = os.path.dirname(__file__) + os.pathsep + os.environ["PATH"] If mpv-1.dll is located elsewhere, you can add that path to os.environ["PATH"].
Have you tried doing what is suggested by the error?
@McSinyx Yes and works, but it worked before the lastest update.
However, i fixed like this:
# mpv.py
os.add_dll_directory(os.getcwd())
if os.name == 'nt':
# dll = ctypes.util.find_library('mpv-1.dll')
dll = CDLL("mpv-1.dll")
...
# backend = CDLL(dll)
backend = dll
fs_enc = 'utf-8'
it worked before the lastest update
That was not very secured so it was fixed sometime ago. See #96 for discussion.