Python libraries import error

Hi Everyone,

I am trying to import “pycrypto 2.6.1” library in ignition, for that i have pasted the directory named "Crypto"in to “C:\Program Files\Inductive Automation\Ignition\user-lib\pylib” directory.

I want to use various functions which are in AES module, located at “Crypto/Cipher”.

In script i am importing the module as—>>

from Crypto.Cipher import AES
container = AES.new('key', AES.MODE_CBC, 'IV')

but the execution of code end with error

Need suggestions for importing the libraries into ignition.

I suppose i am doing something wrong while importing.

I just took a look at the code (https://github.com/dlitz/pycrypto/tree/master/src), and it confirms my initial suspicion that it depends on C-code.

Because of that, the library can’t be used in a Java environment like Ignition with Jython.See the documentation: https://support.inductiveautomation.com/index.php?/Knowledgebase/Article/View/98/2/importing-and-using-3rd-party-python-libraries-in-ignition

You will need to look for another library you can use, or translate the algorithm you want to use to pure python yourself.

Sanderd17 thanks for the reply…

i downloaded the libraries from (https://pypi.python.org/pypi/pycrypto).

Hi, roshanbhosale
Have you solved your promble, I also want to use AES module in Crypto/Cipher library, but didn’t succed, can you share your resources for me?

You cannot use python libraries that use C .dll or .so files. Jython is java, not C. Consider using Java’s built-in crypto libraries, which jython can use.

https://docs.oracle.com/javase/8/docs/api/javax/crypto/package-summary.html