You are not logged in.

#1 2016-04-05 10:39:54

fifafrazer
Member
Registered: 2008-02-18
Posts: 81

gvim python can no longer "import dbus"

This used to work until recently

function! Python_Test()
python << EOF
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
import dbus
EOF
endfunction


if has("python")
    call Python_Test()
endif

If I do ":source test.vim" in gvim I get the following error

Error detected while processing function Python_Test:
line    5:
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/usr/lib/python2.7/site-packages/dbus/__init__.py", line 77, in <module>
    import dbus.types as types
  File "/usr/lib/python2.7/site-packages/dbus/types.py", line 6, in <module>
    from _dbus_bindings import (
ImportError: /usr/lib/python2.7/site-packages/_dbus_bindings.so: undefined symbol: PyExc_KeyboardInterrupt

If I go to the python2.7 interpreter through my terminal emulator and shell and write
"import dbus", I don't get any errors.

Any ideas?

Offline

#2 2016-04-05 13:19:58

fifafrazer
Member
Registered: 2008-02-18
Posts: 81

Re: gvim python can no longer "import dbus"

Downgrading to vim/gvim version 7.4.944-1 fixes this issue.
Seems that some dual support of python2 and python3 has been added since.

I deleted all the occurences of --enable-python3interp=dynamic from the lates PKGBUILD (version 7.4.1689-1) and this has fixed the issue.
There seem to be some trouble with the python dbus binding when python2 and python3 support coexist.

Last edited by fifafrazer (2016-04-05 14:07:14)

Offline

#3 2016-04-05 23:06:14

Yannick_LM
Member
Registered: 2008-12-22
Posts: 142

Re: gvim python can no longer "import dbus"

You could try switching to neovim. Why ? Because neovim is *not* linked with python libraries directly, and Python execution is done differently., via a "regular" python-neovim package.

It may solve you problem.

See here for some caveats regarding performance though.

Offline

#4 2016-04-05 23:09:30

Awebb
Member
Registered: 2010-05-06
Posts: 6,291

Re: gvim python can no longer "import dbus"

Could you provide the link to your bug report on the Arch bug tracker for this issue, please?

Offline

#5 2016-04-06 05:34:52

anatolik
Developer
Registered: 2012-09-27
Posts: 458

Re: gvim python can no longer "import dbus"

The reason of the problem is that /usr/lib/python2.7/site-packages/_dbus_bindings.so does not have link dependency to the python library.

$ ldd /usr/lib/python2.7/site-packages/_dbus_bindings.so | grep python
# compare it to yaml library:
$ ldd /usr/lib/python2.7/site-packages/_yaml.so | grep python
	libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0 (0x00007ffa53d88000)

Contact vim maillist and check with developer why dynamic binding does not preload python lib as static binding did before.

Another question is why libraries like the dbus-python are not linked with python. Someone who has more python experience can help to find an answer to this question.


Read it before posting http://www.catb.org/esr/faqs/smart-questions.html
Ruby gems repository done right https://bbs.archlinux.org/viewtopic.php?id=182729
Fast initramfs generator with security in mind https://wiki.archlinux.org/index.php/Booster

Offline

#6 2016-04-07 23:47:51

lilydjwg
Member
Registered: 2010-06-20
Posts: 53

Re: gvim python can no longer "import dbus"

Sometimes the upstream decides that they don't link with libpython, e.g. xapian https://trac.xapian.org/ticket/623

Offline

#7 2016-04-07 23:59:05

anatolik
Developer
Registered: 2012-09-27
Posts: 458

Re: gvim python can no longer "import dbus"

Posted this question to vim_dev maillist https://groups.google.com/forum/#!topic … 4QAM2wgKKI


Read it before posting http://www.catb.org/esr/faqs/smart-questions.html
Ruby gems repository done right https://bbs.archlinux.org/viewtopic.php?id=182729
Fast initramfs generator with security in mind https://wiki.archlinux.org/index.php/Booster

Offline

#8 2016-04-08 13:54:27

anatolik
Developer
Registered: 2012-09-27
Posts: 458

Re: gvim python can no longer "import dbus"

After some thinking I came to conclusion that modules *should* depend on python.so. Upstream should not force "modules with dangled python.so" like what python-dbus and other modules do.

Not linking modules against python.so solves no issues and creates a lot of new problems that are not possible to resolve cleanly.

Last edited by anatolik (2016-04-08 13:56:41)


Read it before posting http://www.catb.org/esr/faqs/smart-questions.html
Ruby gems repository done right https://bbs.archlinux.org/viewtopic.php?id=182729
Fast initramfs generator with security in mind https://wiki.archlinux.org/index.php/Booster

Offline

#9 2016-04-10 12:56:51

dmerej
Member
From: Paris
Registered: 2016-04-09
Posts: 101
Website

Re: gvim python can no longer "import dbus"

I can confirm that

import dbus

works with neovim


Responsible Coder, Python Fan, Rust enthusiast

Offline

Board footer

Powered by FluxBB