[PyQt] pyqtdeploy: howto add egg's?
Phil Thompson
phil at riverbankcomputing.com
Thu Feb 4 14:07:36 GMT 2016
On 4 Feb 2016, at 1:47 pm, Schluchti <schluchti at gmail.com> wrote:
>
> Hi Phil,
>
> I figured out, that I could just add the corresponding *.so to the resources
> qrc.
>
> The *.so should get loaded with the following code snippet (in _AES.py):
>
> def __bootstrap__():
> global __bootstrap__, __loader__, __file__
> import sys, pkgutil, imp
> __file__ = pkgutil.get_data(__name__,'_AES.cpython-34m.so')
> __loader__ = None; del __bootstrap__, __loader__
> imp.load_dynamic(__name__,__file__)
> __bootstrap__()
>
>
> However, now I get the following error:
>
> File: ":/Crypto/Cipher/_AES.py", line 20 in __bootstrap__
> TypeError: 'NoneType' object is not callable
>
>
> At first I thought, that the *.so filename was just wrong and therefore, I
> got the NoneType Error, so
> I changed the filename in _AES.py to something other like 'test.so'.
> Surprisingly, now, I get a different error message than before:
>
> File ":/pkgutil.py" line 629, in get_data
> ImportError: qrcimporter: error opening file :/Crypto/Cipher/test.so
>
>
> Ok, so the filename should be fine, right? I googled a little bit, and found
> the following statement in the pkgutil documentation: "If the package cannot
> be located or loaded, or it uses a PEP 302 loader which does not support
> get_data(), then None is returned.". Is it possible, that get_data() is not
> implemented in the pyqtdeploy loader or am I doing something completely
> wrong?
get_data() support was added in v1.2, but probably not heavily tested.
Phil
More information about the PyQt
mailing list