Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module 'mpv' has no attribute 'MPV' #60

Closed
TailyFair opened this issue Dec 15, 2017 · 7 comments
Closed

module 'mpv' has no attribute 'MPV' #60

TailyFair opened this issue Dec 15, 2017 · 7 comments

Comments

@TailyFair
Copy link

TailyFair commented Dec 15, 2017

Hi,

Enviroment:
Windows 10 x64
Python 3.6
python-mpv 0.3.7
youtube-dl 2017.12.14
mpv 2017.09.13

I'm trying out examples provided in readme.md.
But I get following error:
module 'mpv' has no attribute 'MPV'

I tried playing around and now I get different error when importing mpv module:

Traceback (most recent call last):
  File "C:\Users\Karolis\Desktop\test.py", line 1, in <module>
    import mpv
  File "C:\Users\Karolis\Desktop\mpv.py", line 31, in <module>
    backend = CDLL('mpv-1.dll')
  File "C:\Users\Karolis\AppData\Local\Programs\Python\Python36-32\lib\ctypes\__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
@jaseg
Copy link
Owner

jaseg commented Dec 17, 2017

Ah, ok. Your first error sounds like it was trying to use something but this project's mpv.py. Make sure you install the python-mpv pypi package.

The second error is because it can't find the libmpv dll. Try to find out where that was installed, then try to make Windows find it. This might mean e.g. adding mpv's installation directory to your PATH environment variable.

@TailyFair
Copy link
Author

TailyFair commented Dec 19, 2017

I dig a bit into this. And I finally managed to get everything working. So installation process is something like that:

  • Regular mpv player binaries do not contain mpv-1.dll, you need to download them from dev package

  • Then extract both mpv.exe + mpv.com and mpv-1.dll into /Scripts folder of your Python

  • After that you can install pip module pip install python-mpv

If you have Python 32 bit, make sure to download 32 bit mpv-1.dll or 64 bit if you're having Python 64 bit. DLL have to match Python bit versions.

@jaseg
Copy link
Owner

jaseg commented Dec 25, 2017

Since it seems to work for you I'll close this issue for now. If you have any more questions, feel free to re-open it or create a new one. I have added a section on supported platforms with a link to this issue to the README in 243414d .

@yellowsoar
Copy link

I use chocolatey to install mpv:
$ choco install mpv
And run python script in virtual env by pipenv
So there's only one more thing to do manually:
Put mpv-1.dll into /Scripts
This might be easier for windows user to maintain.

@McSinyx
Copy link
Contributor

McSinyx commented Oct 9, 2018

I'm not on Windows, but may I ask how is that easier? I agree on putin the dll to where mpv.py is installed, but are all the bloats (choco, pipenv) necessary?

@yellowsoar
Copy link

I'm not on Windows, but may I ask how is that easier? I agree on putin the dll to where mpv.py is installed, but are all the bloats (choco, pipenv) necessary?

Well, install mpv via choco don't need to extract zip file into /Script for each virtual env.
(Or, adding mpv path into system variable path is the same)
And won't need to do that when upgrading mpv later. Just choco upgrade.
(The same way yum, dnf, apt and brew did.)

But pipenv is not necessary, I just mention it for my env.
Sorry for the misunderstanding...

BTW, put mpv-l.dll in the same directory where python script is, will be ok as well.

@McSinyx
Copy link
Contributor

McSinyx commented Oct 9, 2018

Well, install mpv via choco don't need to extract zip file into /Script for each virtual env.

I'm a bit confused, so need one manually copy mpv-1.dll to Script anymore? If not, definitely this is a lot better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants