eonpatapon / mpDris2

MPRIS V2.1 support for mpd
GNU General Public License v3.0
214 stars 46 forks source link

Python 3 support. ModuleNotFoundError: No module named 'mpd' #87

Open DolphinStKom opened 7 years ago

DolphinStKom commented 7 years ago

Need integration for Python 3. When I use any of the branches that get an error

mpDris2 Traceback (most recent call last): File "/usr/bin/mpDris2", line 29, in import mpd ModuleNotFoundError: No module named 'mpd'

as the default in the system python 3. If you change the file /usr/bin/mpris2 and explicitly specify it python version 2, it works. Please correct it please to at least Python 3 branch worked with Python 3.

grawity commented 7 years ago

So install a Python 3-compatible mpd module?

DolphinStKom commented 7 years ago

Excuse me, but do not tell me how to do it? I do not see him having such keys

media-sound/mpd-0.20.4::gentoo USE="alsa bzip2 cdio curl eventfd faad ffmpeg fifo flac glib icu id3tag inotify ipv6 lame libmpdclient mad mpg123 network ogg pulseaudio signalfd systemd tcpd twolame unicode vorbis wavpack zlib -adplug -ao -audiofile -debug -expat -fluidsynth -gme -jack -libav -libsamplerate -libsoxr -mikmod -mms -modplug -musepack -nfs -openal -opus -oss -pipe -recorder -samba (-selinux) -sid -sndfile -soundcloud -sqlite -upnp -wildmidi -zeroconf -zip"

in system

sudo eselect python list
Пароль: 
Available Python interpreters, in order of preference:
  [1]   python3.4
  [3]   python3.6 (fallback)
  [4]   python2.7 (fallback)

mpDris2 from git, I tried to use the master and python3 branches

my ebuild

# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="5"
#PYTHON_COMPAT=( python{3_2,3_3} )
#need change python > python-r1

inherit python autotools eutils git-2

MY_PN="${PN/d/D}"

DESCRIPTION="An implementation of the MPRIS 2 interface as a client for MPD"
HOMEPAGE="http://github.com/eonpatapon/mpDris2"
EGIT_REPO_URI="git://github.com/eonpatapon/mpDris2.git"
#EGIT_BRANCH="python-3"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
IUSE=""

DEPEND=">=dev-lang/python-2.4
        >=dev-python/dbus-python-0.80
        >=dev-python/pygobject-2.14
        >=dev-python/python-mpd-0.3.0"

src_prepare() {
    eautoreconf
}

src_install() {
    emake install DESTDIR="${D}" || die "Failed to install"
}
eonpatapon commented 7 years ago

I'm using https://github.com/Mic92/python-mpd2 with python3 and it works fine

DolphinStKom commented 7 years ago

hm, I'm using

eix python-mpd
[I] dev-python/python-mpd
     Доступные версии:      0.5.4 0.5.5 {test PYTHON_TARGETS="pypy python2_7 python3_4 python3_5"}
     Установленные версии:  0.5.5(21:47:19 03.03.2017)(-test PYTHON_TARGETS="python2_7 python3_4 -pypy -python3_5")
     Домашняя страница:     https://github.com/Mic92/python-mpd2
     Описание:              Python MPD client library

Do you think the problem is in it?

eonpatapon commented 7 years ago

Maybe, can you list the files installed by the package ?

I suspect the module is not installed in the python3 site-packages.

Le Monday 06 Mar 2017 à 00:56:06 (-0800), Stanislav a écrit :

hm, I'm using

eix python-mpd
[I] dev-python/python-mpd
     Доступные версии:      0.5.4 0.5.5 {test PYTHON_TARGETS="pypy python2_7 python3_4 python3_5"}
     Установленные версии:  0.5.5(21:47:19 03.03.2017)(-test PYTHON_TARGETS="python2_7 python3_4 -pypy -python3_5")
     Домашняя страница:     https://github.com/Mic92/python-mpd2
     Описание:              Python MPD client library

Do you think the problem is in it?

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/eonpatapon/mpDris2/issues/87#issuecomment-284337313

DolphinStKom commented 7 years ago
equery files python-mpd
 * Searching for python-mpd ...
 * Contents of dev-python/python-mpd-0.5.5:
/usr
/usr/lib64
/usr/lib64/python2.7
/usr/lib64/python2.7/site-packages
/usr/lib64/python2.7/site-packages/mpd.py
/usr/lib64/python2.7/site-packages/mpd.pyc
/usr/lib64/python2.7/site-packages/mpd.pyo
/usr/lib64/python2.7/site-packages/mpd_test.py
/usr/lib64/python2.7/site-packages/mpd_test.pyc
/usr/lib64/python2.7/site-packages/mpd_test.pyo
/usr/lib64/python2.7/site-packages/python_mpd2-0.5.5-py2.7.egg-info
/usr/lib64/python2.7/site-packages/python_mpd2-0.5.5-py2.7.egg-info/PKG-INFO
/usr/lib64/python2.7/site-packages/python_mpd2-0.5.5-py2.7.egg-info/SOURCES.txt
/usr/lib64/python2.7/site-packages/python_mpd2-0.5.5-py2.7.egg-info/dependency_links.txt
/usr/lib64/python2.7/site-packages/python_mpd2-0.5.5-py2.7.egg-info/top_level.txt
/usr/lib64/python3.4
/usr/lib64/python3.4/site-packages
/usr/lib64/python3.4/site-packages/__pycache__
/usr/lib64/python3.4/site-packages/__pycache__/mpd.cpython-34.pyc
/usr/lib64/python3.4/site-packages/__pycache__/mpd.cpython-34.pyo
/usr/lib64/python3.4/site-packages/__pycache__/mpd_test.cpython-34.pyc
/usr/lib64/python3.4/site-packages/__pycache__/mpd_test.cpython-34.pyo
/usr/lib64/python3.4/site-packages/mpd.py
/usr/lib64/python3.4/site-packages/mpd_test.py
/usr/lib64/python3.4/site-packages/python_mpd2-0.5.5-py3.4.egg-info
/usr/lib64/python3.4/site-packages/python_mpd2-0.5.5-py3.4.egg-info/PKG-INFO
/usr/lib64/python3.4/site-packages/python_mpd2-0.5.5-py3.4.egg-info/SOURCES.txt
/usr/lib64/python3.4/site-packages/python_mpd2-0.5.5-py3.4.egg-info/dependency_links.txt
/usr/lib64/python3.4/site-packages/python_mpd2-0.5.5-py3.4.egg-info/top_level.txt

If I understood correctly

eonpatapon commented 7 years ago

Seems fine. It should work with python3.4

python -c 'import mpd'

Le Monday 06 Mar 2017 à 01:02:55 (-0800), Stanislav a écrit :

equery files python-mpd
 * Searching for python-mpd ...
 * Contents of dev-python/python-mpd-0.5.5:
/usr
/usr/lib64
/usr/lib64/python2.7
/usr/lib64/python2.7/site-packages
/usr/lib64/python2.7/site-packages/mpd.py
/usr/lib64/python2.7/site-packages/mpd.pyc
/usr/lib64/python2.7/site-packages/mpd.pyo
/usr/lib64/python2.7/site-packages/mpd_test.py
/usr/lib64/python2.7/site-packages/mpd_test.pyc
/usr/lib64/python2.7/site-packages/mpd_test.pyo
/usr/lib64/python2.7/site-packages/python_mpd2-0.5.5-py2.7.egg-info
/usr/lib64/python2.7/site-packages/python_mpd2-0.5.5-py2.7.egg-info/PKG-INFO
/usr/lib64/python2.7/site-packages/python_mpd2-0.5.5-py2.7.egg-info/SOURCES.txt
/usr/lib64/python2.7/site-packages/python_mpd2-0.5.5-py2.7.egg-info/dependency_links.txt
/usr/lib64/python2.7/site-packages/python_mpd2-0.5.5-py2.7.egg-info/top_level.txt
/usr/lib64/python3.4
/usr/lib64/python3.4/site-packages
/usr/lib64/python3.4/site-packages/__pycache__
/usr/lib64/python3.4/site-packages/__pycache__/mpd.cpython-34.pyc
/usr/lib64/python3.4/site-packages/__pycache__/mpd.cpython-34.pyo
/usr/lib64/python3.4/site-packages/__pycache__/mpd_test.cpython-34.pyc
/usr/lib64/python3.4/site-packages/__pycache__/mpd_test.cpython-34.pyo
/usr/lib64/python3.4/site-packages/mpd.py
/usr/lib64/python3.4/site-packages/mpd_test.py
/usr/lib64/python3.4/site-packages/python_mpd2-0.5.5-py3.4.egg-info
/usr/lib64/python3.4/site-packages/python_mpd2-0.5.5-py3.4.egg-info/PKG-INFO
/usr/lib64/python3.4/site-packages/python_mpd2-0.5.5-py3.4.egg-info/SOURCES.txt
/usr/lib64/python3.4/site-packages/python_mpd2-0.5.5-py3.4.egg-info/dependency_links.txt
/usr/lib64/python3.4/site-packages/python_mpd2-0.5.5-py3.4.egg-info/top_level.txt

If I understood correctly

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/eonpatapon/mpDris2/issues/87#issuecomment-284338776

DolphinStKom commented 7 years ago

But it does not work either with a master branch or with a branch python3... I have to change the file /usr/bin/mpris2 after installation or reinstallation and explicitly specify it python version 2.

eonpatapon commented 7 years ago

Does the latest command works on your system ?

python -c "import mpd"

Where python is python3.4

Le Monday 06 Mar 2017 à 01:39:31 (-0800), Stanislav a écrit :

But it does not work either with a master branch or with a branch python3... I have to change the file after installation or reinstallation and explicitly specify it python version 2.

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/eonpatapon/mpDris2/issues/87#issuecomment-284347335

DolphinStKom commented 7 years ago

Its work after comand `python -c "import mpd" set python 3.4 (not work with 3.6) not set EGIT_BRANCH="python-3"

final ebuild

# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="5"
PYTHON_COMPAT=( python3_{4,5,6} )

inherit python-r1 autotools eutils git-r3

MY_PN="${PN/d/D}"

DESCRIPTION="An implementation of the MPRIS 2 interface as a client for MPD"
HOMEPAGE="http://github.com/eonpatapon/mpDris2"
EGIT_REPO_URI="git://github.com/eonpatapon/mpDris2.git"
#EGIT_BRANCH="python-3"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
IUSE=""

LANGS="fr nl"

for lang in ${LANGS}; do
    IUSE+=" linguas_${lang}"
done

DEPEND=">=dev-lang/python-2.4
        >=dev-python/dbus-python-0.80
        >=dev-python/pygobject-2.14
        >=dev-python/python-mpd-0.3.0"

DOCS="AUTHORS COPYING INSTALL NEWS README README.md"

src_prepare() {
    eautoreconf
}

_clean_up_locales() {
    einfo "Cleaning up locales..."
    for lang in ${LANGS}; do
        use "linguas_${lang}" && {
            einfo "- keeping ${lang}"
            continue
        }
        rm -Rf "${ED}"/usr/share/locale/"${lang}" || die
    done
}

src_install() {
    emake install DESTDIR="${D}" || die "Failed to install"

    _clean_up_locales

}

This is normal? And how often and when do I need to do this import?

grawity commented 7 years ago

You don't – the command is only for testing whether Python can import that module.

For Python 3.6, you will need to install python-mpd2 (git).