From c6a8088f3ab000cfa09dc688d6bfc5e239c55d5f Mon Sep 17 00:00:00 2001 From: ripdog Date: Wed, 4 Dec 2019 11:42:57 +1300 Subject: [PATCH 1/2] Allow mpv-1.dll to be placed in python script directory (#96) Windows: Look for DLL in script directory Loading DLLs through ctypes on Windows is a mess. ctypes looks in PATH, which is different from the Windows built-in DLL loading system. By default ctypes looks next to python.exe, but you might not want to install python script dependencies next to the system-wide python interpreter. This commit adds a fallback looking for mpv-1.dll in the same directory the mpv.py script is placed in to allow people to use python-mpv with a minimum in configuration. You can still control loading behavior through PATH. For details on this, consult the following stackoverflow answer: https://stackoverflow.com/a/23805306 --- mpv.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mpv.py b/mpv.py index 2b2f73b..19cf63e 100644 --- a/mpv.py +++ b/mpv.py @@ -28,7 +28,10 @@ import re import traceback if os.name == 'nt': - backend = CDLL('mpv-1.dll') + try: + backend = CDLL('mpv-1.dll') + except FileNotFoundError: + backend = CDLL(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'mpv-1.dll')) fs_enc = 'utf-8' else: import locale From 80a0e7888adf85f7c67fa16dd53042da8cc77637 Mon Sep 17 00:00:00 2001 From: jaseg Date: Tue, 3 Dec 2019 23:45:26 +0100 Subject: [PATCH 2/2] Version 0.4.3 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2fad6c9..5e63066 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup setup( name = 'python-mpv', - version = '0.4.2', + version = '0.4.3', py_modules = ['mpv'], description = 'A python interface to the mpv media player', url = 'https://github.com/jaseg/python-mpv',