You are not logged in.

#1 2010-10-25 12:25:43

Xi0N
Member
From: Bilbao - Spain
Registered: 2007-11-29
Posts: 832
Website

Python dependency

Well, im confused because im trying to run a python app, and i get this error:


Traceback (most recent call last):
  File "/usr/lib/rename-to-exif-date/rename-to-exif-date.py", line 25, in <module>
    import gtk
ImportError: No module named gtk

Which is the package in arch that would satisfy this?

It's supposed to be python-gtk2 (in ubuntu) but i see no package named like this in arch....

Offline

#2 2010-10-25 12:28:11

linux-ka
Member
From: ADL
Registered: 2010-05-07
Posts: 232

Re: Python dependency

well, you might search for gtk:

 
pacman -Ss gtk 
extra/pygtk

Last edited by linux-ka (2010-10-25 12:29:03)

Offline

#3 2010-10-25 12:30:06

Xi0N
Member
From: Bilbao - Spain
Registered: 2007-11-29
Posts: 832
Website

Re: Python dependency

I have that package installed, but i still get the same import error sad

extra/pygtk 2.22.0-3 [installed]
    Python bindings for the GTK widget set

Offline

#4 2010-10-25 12:31:16

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: Python dependency

use "python2" and not "python"

Offline

#5 2010-10-25 12:33:24

Xi0N
Member
From: Bilbao - Spain
Registered: 2007-11-29
Posts: 832
Website

Re: Python dependency

I also have python2 installed:

extra/python2 2.7-2 [installed]
    A high-level scripting language

sad

More ideas?

Offline

#6 2010-10-25 12:36:31

linux-ka
Member
From: ADL
Registered: 2010-05-07
Posts: 232

Re: Python dependency

Change the shebang of this script you wanna use from

#!/usr/bin/python

to one of these:

#!/usr/bin/env python2.7
#!/usr/bin/python2.7

EDIT:

or this one:

#!/usr/bin/env python2
#!/usr/bin/env python2

Last edited by linux-ka (2010-10-25 12:46:29)

Offline

#7 2010-10-25 20:34:34

Xi0N
Member
From: Bilbao - Spain
Registered: 2007-11-29
Posts: 832
Website

Re: Python dependency

linux-ka wrote:
#!/usr/bin/env python2
#!/usr/bin/env python2

Sorry for the late reply: I was not at home.

Tried this: not working neither.

I will pass you the link to the aur package, and see if that way someone can sort things out... is very light and does not have many dependencies: Only python and python-gtk

http://aur.archlinux.org/packages.php?ID=42159

Thanks, and i hope we get it to work!! smile

Last edited by Xi0N (2010-10-25 20:37:30)

Offline

#8 2010-10-25 21:10:23

awkwood
Member
From: .au <=> .ca
Registered: 2009-04-23
Posts: 91

Re: Python dependency

The following should at least confirm if GTK is working properly with your version of Python.

python2
# then once the REPL loads
import pygtk
pygtk.require('2.0')
import gtk

If you get any errors just replace the first line above with "python2 -v" to get more detailed info.

Offline

#9 2010-10-25 21:12:04

Xi0N
Member
From: Bilbao - Spain
Registered: 2007-11-29
Posts: 832
Website

Re: Python dependency

I dont get any errors running those commands line by line...

Offline

#10 2010-10-25 21:19:20

wonder
Developer
From: Bucharest, Romania
Registered: 2006-07-05
Posts: 5,941
Website

Re: Python dependency

the build that you point it out needs some modifications.

first of all, dependency from python to python2 then all .py needs a shebang modifications. 3rd modification is to modify python to python2 in rename-to-exif-date. New pkgbuild should look like:

pkgname=rename-to-exif-date
pkgver=0.1.0
pkgrel=2
pkgdesc="Rename the photos dropped on the window to the date and hour in which they were taken."
arch=('any')
url="http://mundogeek.net/rename-to-exif-date/"
license=(GPL)
depends=('python2') 
source=(http://launchpadlibrarian.net/17370687/${pkgname}_$pkgver-2.tar.gz)
md5sums=('197be517220a4eb29e617625af254292')
build() { 
    cd "${srcdir}/${pkgname}-${pkgver}/"
    sed -i -e "s|#![ ]*/usr/bin/python$|#!/usr/bin/python2|" \
              -e "s|#![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" \
              $(find ./ -name '*.py')

    sed -i "s|python|python2|" rename-to-exif-date 

    make install DESTDIR=$pkgdir
}

Note that this is not tested at all and maybe some modifications are needed. But overall, this is what should look

Last edited by wonder (2010-10-25 21:20:59)


Give what you have. To someone, it may be better than you dare to think.

Offline

#11 2010-11-01 21:09:44

Xi0N
Member
From: Bilbao - Spain
Registered: 2007-11-29
Posts: 832
Website

Re: Python dependency

Thanks!!!!
I changed another thing, but without your help, i wouldn't have been able to get it working again...

At least, it installs and runs..... lets see if it also works..

Thank you!

Offline

#12 2010-11-01 21:24:54

Xi0N
Member
From: Bilbao - Spain
Registered: 2007-11-29
Posts: 832
Website

Re: Python dependency

It does not work.... i get some other problem now...

Traceback (most recent call last):
  File "/usr/lib/rename-to-exif-date/rename-to-exif-date.py", line 63, in cb_drag_data_received
    rename(path)
  File "/usr/lib/rename-to-exif-date/rename-to-exif-date.py", line 83, in rename
    tags = EXIF.process_file(img_file)
NameError: global name 'EXIF' is not defined

Offline

Board footer

Powered by FluxBB