Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 505914 - media-gfx/skencil-1.0_alpha784 - /usr/bin/skencil-2.7: File "/usr/lib64/python2.7/site-packages/skencil/Sketch/Base/gtkutils.py", line 73, in process_gtk_font_string: IndexError: list index out of range
Summary: media-gfx/skencil-1.0_alpha784 - /usr/bin/skencil-2.7: File "/usr/lib64/pytho...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard: Pending removal: 2016-11-08
Keywords: PMASKED
Depends on:
Blocks:
 
Reported: 2014-03-27 01:33 UTC by tfuk
Modified: 2016-11-09 10:27 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge--info.log,5.01 KB, text/plain)
2014-03-27 01:33 UTC, tfuk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tfuk 2014-03-27 01:33:41 UTC
Created attachment 373612 [details]
emerge --info

# emerge -pv skencil
 
Calculating dependencies... done!
[ebuild   R   ~] media-gfx/skencil-1.0_alpha784  0 kB
 
------------------
 
Running "skencil" from the terminal $:
 
$ skencil
Traceback (most recent call last):
  File "/usr/bin/skencil-2.7", line 6, in <module>
    skencil_run()
  File "/usr/lib64/python2.7/site-packages/skencil/__init__.py", line 12, in skencil_run
    import Sketch
  File "/usr/lib64/python2.7/site-packages/skencil/Sketch/__init__.py", line 57, in <module>
    ui_fonts = gtkutils.get_gtk_fonts()
  File "/usr/lib64/python2.7/site-packages/skencil/Sketch/Base/gtkutils.py", line 47, in get_gtk_fonts
    normal_font = process_gtk_font_string(font)
  File "/usr/lib64/python2.7/site-packages/skencil/Sketch/Base/gtkutils.py", line 73, in process_gtk_font_string
    font_size = int(vals[-1])
IndexError: list index out of range
 
----------
 
It fails on gtkutils.py because the font, that is passed to vals[] that is empty, is got around line 42 in this way:
 
<---
import os
from tempfile import NamedTemporaryFile
 
command = "import gtk;w = gtk.Window();w.realize();style=w.get_style(); print style.font_desc.to_string();"
os.system('python -c "%s" >%s 2>/dev/null' % (command, tmpfile.name))
 
font = tmpfile.readline().strip()
--->
 
The 'command' just fails in python3 (system's default), but it works on python2.7, because of pygtk:
 
# emerge -pv pygtk
Calculating dependencies... done!
[ebuild   R    ] dev-python/pygtk-2.24.0-r4:2  USE="-doc -examples {-test}" PYTHON_TARGETS="python2_7 -python2_6" 0 kB
 
$ python --version
Python 3.3.3
$ python -c "import gtk"
Traceback (most recent call last):
 File "<string>", line 1, in <module>
ImportError: No module named 'gtk'
$ python -c "import gtk;w = gtk.Window();w.realize();style=w.get_style(); print style.font_desc.to_string();"
 File "<string>", line 1
   import gtk;w = gtk.Window();w.realize();style=w.get_style(); print style.font_desc.to_string();
                                                                          ^
SyntaxError: invalid syntax
 
$ python2.7 --version
Python 2.7.5
$ python2.7 -c "import gtk"
$ python2.7 -c "import gtk;w = gtk.Window();w.realize();style=w.get_style(); print style.font_desc.to_string();"
Sans 10
 
 
Thus, the workaround was just change 'python' to 'python2.7' on line 43 of gtkutils.py
   os.system('python2.7 -c "%s" >%s 2>/dev/null' % (command, tmpfile.name))
 
In the same way, another error occurs because of line 225 of the same file:
os.system('python -c "%s" >%s 2>/dev/null' % (command, tmpfile.name))
 
which also is corrected by just changing to 'python2.7'
os.system('python2.7 -c "%s" >%s 2>/dev/null' % (command, tmpfile.name))
Comment 1 Pacho Ramos gentoo-dev 2016-09-30 15:50:56 UTC
CCing treecleaners (dead since 2010 and needs migration to new python eclasses)
Comment 2 Pacho Ramos gentoo-dev 2016-11-09 10:27:21 UTC
removed