Comments (10)
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.
Hello Frechdachs,
Thank you for the response! I didn't have the mpv-1.dll file so I just downloaded it.
- Changed to
backend = CDLL('mpv-1.dll')
- Moved
mpv-1.dll
into thelib/site-packages
folder withmpv.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.
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.
@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.
@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;
- python -m pip install https://github.com/jaseg/python-mpv/zipball/master
This will download and install the mpv library- Go to mpv.py in your library. Mine was under;
c://Users/User_Name/AppData/Local/Programs/Python/Python35-32/Lib/site-packages
- Ensure that
backend = CDLL('mpv-1.dll')
in the following statement (found at the top ofmpv.py
)
if os.name == 'nt':
backend = CDLL('mpv-1.dll')
fs_enc = 'utf-8'
else:
- Go here download the latest dev package.
- 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.
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.
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.
@jaseg: Oh, and on Linux you should probably check if find_library
returns None
and raise a less cryptic exception.
from python-mpv.
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.
Thank you, that is exactly what I had in mind.
from python-mpv.
Related Issues (20)
- python-mpv not finding libmpv DLL on MSYS2 HOT 7
- no-border not working as intended HOT 1
- tests/test_mpv.py::TestLifecycle::test_wait_for_event_shutdown hangs HOT 1
- Audio controls
- I do not literally know which DLLs does it need to consume HOT 2
- How to directly play audio bytes? HOT 2
- "Cannot find libmpv in the usual places" on Arch Linux, Hypnotix HOT 2
- How to replace mpv.MpvEventID.METADATA_UPDATE ? HOT 2
- Loadfile command broken by API change in mpv v0.38.0 HOT 5
- The PyPI package is not up to date HOT 3
- playlist_next() and playlist_prev() beyond end of playlist causes SystemError HOT 1
- [QUESTION] How do I add custom scripts? HOT 2
- QOpenGLWidget is displayed in its own window since ibmpv.so.2.3.0 HOT 3
- SyntaxError on Mac os with python3 on v1.0.6 HOT 2
- Unable to set Gapless Playback option HOT 3
- Is it possible to read music files from an USB key or HD ? HOT 1
- trying to capture mouse clicks when running mpv HOT 2
- wait_until_playing and wait_for_property throws exception HOT 3
- wait_until_playing() seems to be triggered too early HOT 2
- How to set User-Agent? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-mpv.