On Mon, May 28, 2012 at 10:46 AM, Rene Maurer <[email protected]> wrote:
> On 05/28/2012 at 09:05 C Anthony Risinger <[email protected]> wrote:
>> On May 28, 2012 3:39 AM, "Rene Maurer" <[email protected]> wrote:
>>> On 05/28/2012 at 10:05 Rene Maurer <[email protected]> wrote:
>>>
>>> [helloworld]$ ../../../pyjs/bin/pyjd Hello.py
>>> Traceback (most recent call last):
>>> File "Hello.py", line 1, in <module>
>>> import pyjd # this is dummy in pyjs.
>>> File "/home/rene/Local/python/pyjs/pyjs/pyjd/__init__.py", line 37,
>>> in <module> from giwebkit import *
>>> File "/home/rene/Local/python/pyjs/pyjs/pyjd/giwebkit.py", line 46,
>>> in <module> gi.require_version('WebKit', '3.0')
>>> File "/usr/lib/python2.7/site-packages/gi/__init__.py", line 48, in
>>> require_version raise ValueError('Namespace %s not available' %
>>> namespace) ValueError: Namespace WebKit not available
>>
>> Yeah I thought this might happen :-(
>>
>> The GI stuff can't find the typelib or GIR file ... there is an env
>> var that can be exported (I've done it before) but I don't recall
>> which ATM and I'm on the road.
>
>
> GI_TYPELIB_PATH ?
>
>
> [helloworld]$ export GI_TYPELIB_PATH=/usr/local/lib/girepository-1.0
>
> [helloworld]$ ../../../pyjs/bin/pyjd Hello.py
>
> (Hello.py:2153): Gdk-WARNING **: The GDK_NATIVE_WINDOWS environment
> variable is not supported in GTK3.
> See the documentation for gdk_window_ensure_native() on how to get
> native windows.
> Traceback (most recent call last):
> File "Hello.py", line 15, in <module>
> pyjd.setup("public/Hello.html?fred=foo#me")
> File "/home/rene/Local/python/pyjs/pyjs/pyjd/__init__.py", line 78,
> in setup
> _setup(*args, **kwargs)
> File "/home/rene/Local/python/pyjs/pyjs/pyjd/giwebkit.py", line 348,
> in setup
> gobject.threads_init()
> File "/usr/lib/python2.7/site-packages/gi/module.py", line 282, in
> __getattr__
> from . import _gobject
> File "/home/rene/Local/python/pyjs/pyjs/pyjd/imputil.py", line 140,
> in _import_hook
> return importer._finish_import(top_module, parts[1:], fromlist)
> File "/home/rene/Local/python/pyjs/pyjs/pyjd/imputil.py", line 280,
> in _finish_import
> self._import_fromlist(bottom, fromlist)
> File "/home/rene/Local/python/pyjs/pyjs/pyjd/imputil.py", line 370,
> in _import_fromlist
> raise ImportError, "cannot import name " + subname
> ImportError: cannot import name ._gobject
try this (prob add to top of giwebkit.py):
>>> from gi.repository import GIRepository
>>> GIRepository.Repository.prepend_search_path('/usr/local/lib/girepository-1.0')
>>> from gi.repository import WebKit
... worked for me when i manually moved a module:
>>> from gi.repository import xrandr
ERROR:root:Could not find any typelib for xrandr
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name xrandr
>>> from gi.repository import GIRepository
>>> GIRepository.Repository.prepend_search_path('/usr/local/lib/girepository-1.0')
>>> from gi.repository import xrandr
>>> xrandr
<gi.module.DynamicModule 'xrandr' from
'/usr/local/lib/girepository-1.0/xrandr-1.3.typelib'>
--
C Anthony