pyqtdeploy: add external modules

424 Views Asked by At

is there someone who has experience with pyqtdeploy and adding external modules? I am currently using pyqtdeploy (version 1.2) together with PyQt 5.5.1 to write an application that can be deployed to an Android device. Without any external modules, the freezing with pyqtdeploy works pretty well. However, I am not really sure how I can add external modules (not pure Python ones) to my application.

In particular, I want to add the external module pycrypto. Therefore, I downloaded the pycrypto sourcecode, compiled it with the Android toolchain (from the Android NDK) and now I have a bunch of *.py and *.so files. How can I add them to my application?

My initial attempt was to add the *.py and the *.so files (so basically the whole pycrypto module) to the "Other Packages" tab in pyqtdeploy. But now, when I import something pycrypto related in my application (from Crypto.Cipher import AES) i get the following error message:

File: ":/Crypto/Cipher/_AES.py", line 20 in __bootstrap__ TypeError: 'NoneType' object is not callable

The _AES.py file where the error is thrown, looks like this:

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__()

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? But why do i get the 'NoneType` error message? What am I doing wrong? Is this the right way to accomplish this?

Any help is highly appreciated. I am pretty sure, that i'm only one small step away from getting this thing to work, but I can't figure out what i'm doing wrong.

Thanks!

0

There are 0 best solutions below