Skip to content
This repository has been archived by the owner on Oct 29, 2018. It is now read-only.

Fixing gi import warnings (#288) #421

Closed
wants to merge 2 commits into from
Closed

Conversation

raelgc
Copy link
Owner

@raelgc raelgc commented Apr 4, 2016

Fixes #288

@raelgc
Copy link
Owner Author

raelgc commented Apr 4, 2016

@immerrr Can you test if these changes will work on Ubuntu 12.04?

@immerrr
Copy link
Collaborator

immerrr commented Apr 4, 2016

  1. it appears that the proper way of invoking require_version is gi.require_version, not gi.repository.require_version:
$ /usr/bin/python3 -c "from gi.repository import require_version"
ERROR:root:Could not find any typelib for require_version
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: cannot import name require_version
$ /usr/bin/python3 -c "from gi import require_version"
  1. notify is OK:
$ /usr/bin/python3 -c "from gi import require_version; print(require_version('Notify', '0.7'))"
None
  1. Unity 7.0 is unavailable, only 5.0 works:
$ /usr/bin/python3 -c "from gi import require_version; print(require_version('Unity', '7.0'))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 52, in require_version
    (namespace, version))
ValueError: Namespace Unity not available for version 7.0
$ /usr/bin/python3 -c "from gi import require_version; print(require_version('Unity', '5.0'))"
None

@raelgc
Copy link
Owner Author

raelgc commented Apr 4, 2016

@immerrr Thank you for the quick reply!

I tried first with gi.require_version, but on 16.04 I got this error: NameError: name 'gi' is not defined. So first importing the require_version worked.

But, unfortunately appears to not works in 12.04 (not sure in 14.04).

About Unity version: so, version is 5 for Ubuntu 12.04. Not sure if we add a complicated checking here or if we keep 12.04 in a separate branch.

@immerrr
Copy link
Collaborator

immerrr commented Apr 4, 2016

NameError: name 'gi' is not defined means you need to do import gi before doing gi.require_version.

@stieg
Copy link
Collaborator

stieg commented Apr 4, 2016

Here is what I see on my Fedora box:

[stieg@Lucious scudcloud]$ python3 -m scudcloud 
Traceback (most recent call last):
  File "/usr/lib64/python3.4/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.4/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/stieg/Devel/stieg/scudcloud/scudcloud/__main__.py", line 16, in <module>
    import scudcloud.scudcloud as sca
  File "/home/stieg/Devel/stieg/scudcloud/scudcloud/scudcloud.py", line 28, in <module>
    gi.require_version('Unity', '7.0')
  File "/usr/lib64/python3.4/site-packages/gi/__init__.py", line 102, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Unity not available

@raelgc
Copy link
Owner Author

raelgc commented Mar 29, 2017

Fixed in #254

@raelgc raelgc closed this Mar 29, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants