Error using python3-gi dependency

Sergio Cazzolato sergio.cazzolato at canonical.com
Tue Dec 20 19:32:27 UTC 2016


This solution works, thanks!!

On Tue, Dec 20, 2016 at 4:18 PM, Chris Wayne <chris.wayne at canonical.com>
wrote:

> Hi Sergio,
>
> You could try having a wrapper set something like this:
>
> export GI_TYPELIB_PATH=$SNAP/usr/lib/girepository-1.0:$SNAP/usr/lib/$ARCH/girepository-1.0
> where $ARCH is defined like this:
>
> case "$SNAP_ARCH" in
>     "amd64") ARCH='x86_64-linux-gnu'
>     ;;
>     "i386") ARCH='i386-linux-gnu'
>     ;;
>     "arm64") ARCH='aarch64-linux-gnu'
>     ;;
>     "armhf") ARCH='arm-linux-gnueabihf'
>     ;;
>     *)
>         echo "Unsupported architecture: $SNAP_ARCH"
>     ;;
> esac
>
> Hope that helps!
>
> Thanks
> Chris
>
> On Tue, Dec 20, 2016 at 2:00 PM, Sergio Cazzolato <
> sergio.cazzolato at canonical.com> wrote:
>
>> Hello, I am creating a snap which has a the python3-gi dependency (as it
>> is shown below)
>>
>> parts:
>>
>>   kpi-dbus-tests:
>>     plugin: nil
>>     stage-packages:
>>       - gir1.2-glib-2.0
>>       - python3-dbus
>>       - python3-gi
>>
>>
>> When I run the python script which is using the gi dependency I am
>> getting some errors when it try to import the dependencies. I took a look
>> and the dependencies are installed correctly.
>>
>> Traceback (most recent call last):
>>   File "/snap/kpi-dbus-tests/x1/dbus_signal_spammer.py", line 25, in
>> <module>
>>     from gi.repository import GObject
>>   File "/snap/kpi-dbus-tests/x1/usr/lib/python3/dist-packages/gi/importer.py",
>> line 127, in find_module
>>     'introspection typelib not found' % namespace)
>> ImportError: cannot import name GObject, introspection typelib not found
>>
>> Traceback (most recent call last):
>>   File "<frozen importlib._bootstrap>", line 890, in _find_spec
>> AttributeError: 'DynamicImporter' object has no attribute 'find_spec'
>>
>> Also in classic mode, I manually installed the dependencies and executed
>> the python script and it works properly.
>>
>> Any idea about which could be the problem?
>>
>> Thanks
>>
>> --
>> Snapcraft mailing list
>> Snapcraft at lists.snapcraft.io
>> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailm
>> an/listinfo/snapcraft
>>
>>
>
> --
> Snapcraft mailing list
> Snapcraft at lists.snapcraft.io
> Modify settings or unsubscribe at: https://lists.ubuntu.com/
> mailman/listinfo/snapcraft
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20161220/17641ca7/attachment.html>


More information about the Snapcraft mailing list