GithubHelp home page GithubHelp logo

Comments (10)

Frechdachs avatar Frechdachs commented on August 27, 2024

It can't find the libmpv library, so ctypes.util.find_library('mpv-1.dll') returns None.
CDLL(None) throws the above exception.

Encountered a similar error recently, apparently find_library does not look in the script's location when searching for the library on Windows. Which is unfortunate because on Windows librarys usually get packaged with the application.

Try to replace

backend = CDLL(ctypes.util.find_library('mpv-1.dll'))

with

backend = CDLL('mpv-1.dll')

and it should work.

EDIT:
In case you don't have a mpv-1.dll yet, you can download one here. (It's included in the Dev-package.)

from python-mpv.

ZachaRuba avatar ZachaRuba commented on August 27, 2024

Hello Frechdachs,
Thank you for the response! I didn't have the mpv-1.dll file so I just downloaded it.

  1. Changed to backend = CDLL('mpv-1.dll')
  1. Moved mpv-1.dll into the lib/site-packages folder with mpv.py

Different error; still seems that it can't find the file:

OSError: [WinError 126] The specified module could not be found

Since the find_library does not look in the script's location, I imagine mpv-1.dll has to be moved somewhere else.

from python-mpv.

Frechdachs avatar Frechdachs commented on August 27, 2024

If you are using backend = CDLL('mpv-1.dll') then python will look for the library in your system search path and the path of YOUR script. (It will not look in the path of mpv.py)

If you are using backend = CDLL(ctypes.util.find_library('mpv-1.dll')) then python will only look in the system search path.

So just put it in a directory that's in your Path variable and it should work either way.

from python-mpv.

jaseg avatar jaseg commented on August 27, 2024

@Frechdachs Thank you for the clarification!

I added find_library after #10, but this looks like not using it might actually be a better idea on windows.

from python-mpv.

ZachaRuba avatar ZachaRuba commented on August 27, 2024

@Frechdachs Thank you!
Moved the 32 version mpv-1.dll into the same directory as my script testscript.py that included
import mvp-1.dll. Working now.
edit: Just tested it with backend = CDLL(ctypes.util.find_library('mpv-1.dll')) and it still works.

To Recap for those who want to install this using python 3.5 on windows 10;

  1. python -m pip install https://github.com/jaseg/python-mpv/zipball/master
    This will download and install the mpv library
  2. Go to mpv.py in your library. Mine was under;
    c://Users/User_Name/AppData/Local/Programs/Python/Python35-32/Lib/site-packages
  3. Ensure that backend = CDLL('mpv-1.dll') in the following statement (found at the top of mpv.py)

if os.name == 'nt':
backend = CDLL('mpv-1.dll')
fs_enc = 'utf-8'
else:

  1. Go here download the latest dev package.
  2. From the dev pkg, copy the mpv-1.dll file (try 32 version first) and place it in the same directory
    as your script that is importing the mpv library

*Side note: if you don't want to have to include the mpv-1.dll file everytime in the same directory as your script then place the mpv-1.dll file under your system search path

from python-mpv.

Frechdachs avatar Frechdachs commented on August 27, 2024

edit: Just tested it with backend = CDLL(ctypes.util.find_library('mpv-1.dll')) and it still works.

Odd, I tried it on a Windows 8.1 VM and it only found libmpv if I put it in the system search path.

(try 32 version first)

Well, you have to use 32 bit if your python installation is 32 bit and 64 bit if your python installation is 64 bit.

from python-mpv.

Frechdachs avatar Frechdachs commented on August 27, 2024

I added find_library after #10, but this looks like not using it might actually be a better idea on windows.

I don't see an advantage of using find_library on Windows, since apparently you have to specify the full filename anyway.

from python-mpv.

Frechdachs avatar Frechdachs commented on August 27, 2024

@jaseg: Oh, and on Linux you should probably check if find_library returns None and raise a less cryptic exception.

from python-mpv.

jaseg avatar jaseg commented on August 27, 2024

I pushed a commit that should fix this on both windows and linux. It seems to work for me, but if you are bored feel free to test it. I seem to have some weird problem with the unit tests on my (new) setup right now.

from python-mpv.

Frechdachs avatar Frechdachs commented on August 27, 2024

Thank you, that is exactly what I had in mind.

from python-mpv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.