Python2: problem with importing lazr.restfulclient

Kyle Fazzari kyle.fazzari at canonical.com
Mon Jun 27 17:59:37 UTC 2016


On 06/27/2016 01:55 PM, Sergio Schvezov wrote:
> 
> 
> El 27/06/16 a las 14:29, John Agosta escribió:
>> Hi:
> 
> Hi there!
> 
>> I am attempting to create a launchpad API part and have run into an
>> issue with the snap correctly resolving lazr.restfulclient.
> 
>> The error I get is:
>>
>>        Traceback (most recent call last):
>>          File "/snap/lptools-john/x2/usr/bin/testreport.py", line 9, in
>>     <module>
>>            from launchpadlib.launchpad import Launchpad
>>          File
>>     "/snap/lptools-john/x2/usr/lib/python2.7/dist-packages/launchpadlib/launchpad.py",
>>     line 33, in <module>
>>            from lazr.restfulclient.resource import (
>>        ImportError: No module named lazr.restfulclient.resource
> 
> I am not entirely sure what is up with this module coming from the
> debian package in the archives but Kyle (CCed) has had success with this
> by grabbing the package from pypi directly using the `python-packages`
> keyword.

Indeed. I've not investigated this enough to know for sure, but it seems
that the lazr deb doesn't contain the correct __init__.py files. I
suspect they're setup after the fact, e.g. in a postinst. Anyway, as
Sergio said, I was able to work around it by using `python-packages`
instead. My use-case was launchpadlib as well, so you might find this
useful:

    https://github.com/kyrofa/cla-check/blob/master/snapcraft.yaml

--
Kyle Fazzari (kyrofa)
Software Engineer
Canonical Ltd.
kyle at canonical.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20160627/badc9e76/attachment.sig>


More information about the Snapcraft mailing list