Bug 32956 - python-module-pygobject3 'gi.repository.Gdk' object has no attribute 'Color'
Summary: python-module-pygobject3 'gi.repository.Gdk' object has no attribute 'Color'
Status: CLOSED NOTABUG
Alias: None
Product: Sisyphus
Classification: Development
Component: python-module-pygobject3 (show other bugs)
Version: unstable
Hardware: all Linux
: P3 normal
Assignee: Yuri N. Sedunov
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-29 15:51 MSK by gBopHuk
Modified: 2016-12-29 19:26 MSK (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gBopHuk 2016-12-29 15:51:35 MSK
При попытке импорта Gdk получаю ошибку об отсутвии поля Color:

Воспроизведение:

  Запускаем ipython  и сразу импортируем Gdk
--------------------------------------
In [1]: from gi.repository import Gdk
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-1729d27468b9> in <module>()
----> 1 from gi.repository import Gdk

/usr/lib64/python2.7/site-packages/gi/importer.pyc in load_module(self, fullname)
    144             for dep in repository.get_immediate_dependencies(namespace):
    145                 importlib.import_module('gi.repository.' + dep.split("-")[0])
--> 146             dynamic_module = load_overrides(introspection_module)
    147
    148         dynamic_module.__file__ = '<%s>' % fullname

/usr/lib64/python2.7/site-packages/gi/overrides/__init__.pyc in load_overrides(introspection_module)
    123             return introspection_module
    124
--> 125         override_mod = importlib.import_module(override_package_name)
    126
    127     finally:

/usr/lib64/python2.7/importlib/__init__.pyc in import_module(name, package)
     35             level += 1
     36         name = _resolve_name(name[level:], package, level)
---> 37     __import__(name)
     38     return sys.modules[name]

/usr/lib64/python2.7/site-packages/gi/overrides/Gdk.py in <module>()
     41
     42
---> 43 class Color(Gdk.Color):
     44     MAX_VALUE = 65535
     45

/usr/lib64/python2.7/site-packages/gi/module.pyc in __getattr__(self, name)
    137         if not info:
    138             raise AttributeError("%r object has no attribute %r" % (
--> 139                                  self.__name__, name))
    140
    141         if isinstance(info, EnumInfo):

AttributeError: 'gi.repository.Gdk' object has no attribute 'Color'

---------------------------------------------------
Пакеты в системе:
  $ rpm -qa | grep -i "(python-module-pygobject3)"
  python-module-pygobject3-common-devel-3.22.0-alt1.x86_64
  python-module-pygobject3-3.22.0-alt1.x86_64
  python-module-pygobject3-devel-3.22.0-alt1.noarch
  $ rpm -qa | egrep -i --color -- "(ipython)"
  python-module-ipython_genutils-0.1.0-alt1.1.1.noarch
  ipython-4.0.0-alt3.1.1.noarch
-------------------------------

Не исключаю что я не правильно делаю импорт, но данный код не вызывал проблем ещё пару месяцев назад.
Comment 1 Yuri N. Sedunov 2016-12-29 16:33:40 MSK
Не воспроизводится:

$ python
Python 2.7.11 (default, Apr 15 2016, 13:09:43) 
[GCC 5.3.1 20151207 (ALT Linux 5.3.1-alt3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>> gi.require_version('Gdk', '3.0')
>>> from gi.repository import Gdk
>>> 
______________________________________________________________
$ ipython
Python 2.7.11 (default, Apr 15 2016, 13:09:43) 
Type "copyright", "credits" or "license" for more information.

IPython 4.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import gi

In [2]: gi.require_version('Gdk', '3.0')

In [3]: from gi.repository import Gdk

In [4]:
Comment 2 gBopHuk 2016-12-29 18:00:46 MSK
(В ответ на комментарий №1)
> Не воспроизводится:
> 
> $ python
> Python 2.7.11 (default, Apr 15 2016, 13:09:43) 
> [GCC 5.3.1 20151207 (ALT Linux 5.3.1-alt3)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import gi
> >>> gi.require_version('Gdk', '3.0')
> >>> from gi.repository import Gdk
> >>> 
> ______________________________________________________________
> $ ipython
> Python 2.7.11 (default, Apr 15 2016, 13:09:43) 
> Type "copyright", "credits" or "license" for more information.
> 
> IPython 4.0.0 -- An enhanced Interactive Python.
> ?         -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help      -> Python's own help system.
> object?   -> Details about 'object', use 'object??' for extra details.
> 
> In [1]: import gi
> 
> In [2]: gi.require_version('Gdk', '3.0')
> 
> In [3]: from gi.repository import Gdk
> 
> In [4]:

Интересно, может мне надо что-то ещё доустановить?
$ipython
Python 2.7.11 (default, Apr 15 2016, 13:09:43)
Type "copyright", "credits" or "license" for more information.

IPython 4.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]:import gi
ERROR - failed to write data to stream: <open file '<stdout>', mode 'w' at 0x7fc2c14c0150>
Comment 3 gBopHuk 2016-12-29 18:06:31 MSK
(В ответ на комментарий №2)

> Интересно, может мне надо что-то ещё доустановить?
> $ipython
> Python 2.7.11 (default, Apr 15 2016, 13:09:43)
> Type "copyright", "credits" or "license" for more information.
> 
> IPython 4.0.0 -- An enhanced Interactive Python.
> ?         -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help      -> Python's own help system.
> object?   -> Details about 'object', use 'object??' for extra details.
> 
> In [1]:import gi
> ERROR - failed to write data to stream: <open file '<stdout>', mode 'w' at
> 0x7fc2c14c0150>

Простите, не в том окружении запускал.

Вот результат из того окружения где собираю пакет.

ython 2.7.11 (default, Apr 15 2016, 13:09:43)
Type "copyright", "credits" or "license" for more information.

IPython 4.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import gi

In [2]: gi.require_version('Gdk', '3.0')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-4a32b79a80ff> in <module>()
----> 1 gi.require_version('Gdk', '3.0')

/usr/lib64/python2.7/site-packages/gi/__init__.pyc in require_version(namespace, version)
    120     if version not in available_versions:
    121         raise ValueError('Namespace %s not available for version %s' %
--> 122                          (namespace, version))
    123
    124     _versions[namespace] = version

ValueError: Namespace Gdk not available for version 3.0
Comment 4 Yuri N. Sedunov 2016-12-29 19:26:50 MSK
(В ответ на комментарий №3)

> 
> ValueError: Namespace Gdk not available for version 3.0

libgtk+3-gir

И проверьте, чтобы в ваше сборочное окружение попал rpm-build-gir.