gu-fan / colorv.vim

edit color easy
http://www.vim.org/scripts/script.php?script_id=3597
135 stars 12 forks source link

colorv#dropper python3 compatibility #3

Closed lleixat closed 12 years ago

lleixat commented 12 years ago

Hi, I experience this issue with current master 2.5.1 version and colorv#dropper (spawning ColorPicker):

line 27:
Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/usr/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py", line 30, in <module>
        import gobject as _gobject
    File "/usr/lib/python2.7/site-packages/gobject/__init__.py", line 26, in <module>
        from glib import spawn_async, idle_add, timeout_add, timeout_add_seconds, \
    File "/usr/lib/python2.7/site-packages/glib/__init__.py",line 22, in <module>
        from glib._glib import *
 ImportError: /usr/lib/libpyglib-2.0-python2.so.0: undefined symbol: PyExc_ImportError 

vim: 7.3 1-294 version compiled with +python/dyn and +python3/dyn python: v 3.2.2 os: linux 3.0-Arch x86_64

And many thanks for your hard work!

:wq! ;)

gu-fan commented 12 years ago

The plugin supports python 2.x only. Also using #dropper need to install the pygtk2.0 module for python 2.x if after you install python 2.7 and still have bugs. stop using the #dropper :(

gu-fan commented 12 years ago

I will add py3 support to todo list.

lleixat commented 12 years ago

Actually I forgot that little detail. It is not so easy to live with python dependencies ;) Is it possible (and how) to force the use of this script with python2 [like in #!/usr/bin/env python2] ? (I tried several possibilities but without success.)

Thank you again to consider!

gu-fan commented 12 years ago

I don't know.
and even with '#!/usr/bin/env python2' . it only works under linux.

gu-fan commented 12 years ago

And there are errors when exec py3 on my machine. told me no py3 after using python command..

gu-fan commented 12 years ago

I think vim is using python and python3 separately. because :python is for python2.x :python3 is for python3.x and this script is using :python so I think you should check your python2.x library

lleixat commented 12 years ago

I don't know. On my system python is an python 3.2 alias. pygtk 2.24 is properly installed too. I've tried to replace the /usr/bin/python -> /usr/bin/python2 alias, but nothing changes and the error is the same as above. Maybe the problem is pygtk2 compatibility.

Best regards.

gu-fan commented 12 years ago

try this

python import pygtk,gtk
python print pygtk,gtk

my output.

<module 'pygtk' from '/usr/lib/python2.7/dist-packages/pygtk.pyc'> <module 'gtk'
 from '/usr/lib/pymodules/python2.7/gtk-2.0/gtk/__init__.pyc'>
gu-fan commented 12 years ago

I thinks it's because vim falsely compiled or python package mistake. I tried under arch linux and got this either. but no error when execute import gtk with python interpreter

lleixat commented 12 years ago

hi, with python2 only: <module 'pygtk' from '/usr/lib/python2.7/site-packages/pygtk.pyc'><module 'gtk' from '/usr/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.pyc'>

with python3, pygtk seems not be compatible (maybe). Another way to build UIs with py is using python-gobject (pyGI). A dirty-crappy way to use it with pygtk is doing this import: from gi.repository import Gtk and you can continue to use pyGTK.

gu-fan commented 12 years ago

As I'm using Archlinux now. I can tell you what's wrong here now.

The gvim Archlinux compiled didn't link python2.7 correctly. You should recompile gvim yourself.

And before compile, don't forget to link python with python2.7 with ln -sf python2.7 python

lleixat commented 12 years ago

ok, thanks for the answer ;)

gu-fan commented 12 years ago

the PKGBUILD of gvim also mentioned this:

fix python name

sed -i -e 's|vi_cv_path_python, python|vi_cv_path_python, python2|' \ vim-build/src/configure.in