<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1183787091;
        mso-list-type:hybrid;
        mso-list-template-ids:443595536 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1
        {mso-list-id:2110658500;
        mso-list-type:hybrid;
        mso-list-template-ids:-755583480 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l1:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l1:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l1:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l1:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l1:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l1:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l1:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l1:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l1:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hello!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’m attempting to import a module (<a href="https://code.google.com/p/killerbee/">KillerBee</a>) in IronPython. I’ve encountered a couple of issues along the way, some of which I’ve been able to fix. I’m hoping the mailing list can help
 me out with what I haven’t fixed. Here are the problems I’ve encountered and the steps I’ve taken:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo1"><![if !supportLists]><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">      
</span></span><![endif]>“Exception during object creation: no module named killerbee”<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.0in;text-indent:-.25in;mso-list:l0 level2 lfo1">
<![if !supportLists]><span style="mso-list:Ignore">a.<span style="font:7.0pt "Times New Roman"">      
</span></span><![endif]>Per <a href="http://stackoverflow.com/questions/1371994/importing-external-module-in-ironpython">
http://stackoverflow.com/questions/1371994/importing-external-module-in-ironpython</a>, I added the following which allowed IronPython to recognize killerbee as a module and let me import it:<br>
<br>
var paths = engine.GetSearchPaths();<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.0in">paths.Add(@"/usr/lib/python2.7/site-packages/");<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.0in">engine.SetSearchPaths(paths);<br>
<br>
<o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo1"><![if !supportLists]><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">      
</span></span><![endif]>“Exception during object creation: cannot import _AES from Crypto.Cipher”<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.0in;text-indent:-.25in;mso-list:l0 level2 lfo1">
<![if !supportLists]><span style="mso-list:Ignore">a.<span style="font:7.0pt "Times New Roman"">      
</span></span><![endif]>I tracked this error down to this line in a killerbee file “dot154decode.py”:<br>
<br>
“from Crypto.Cipher import AES”<br>
<br>
and then further to /usr/lib/python2.7/site-packages/Crypto/Cipher/AES.py:<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.0in"><br>
“from Crypto.Cipher import _AES”<br>
<i><br>
</i>In the same directory as AES.py there is an _AES.so.<br>
<br>
<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.0in;text-indent:-.25in;mso-list:l0 level2 lfo1">
<![if !supportLists]><span style="mso-list:Ignore">b.<span style="font:7.0pt "Times New Roman"">     
</span></span><![endif]>If I attempt this from the python interpreter, there are no errors:<br>
<br>
$ python<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.0in">Python 2.7.8 (default, Sep 24 2014, 18:26:21)
<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.0in">[GCC 4.9.1 20140903 (prerelease)] on linux2<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.0in">Type "help", "copyright", "credits" or "license" for more information.<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.0in">>>> from Crypto.Cipher import AES<br>
>>> import Crypto<br>
>>> print Crypto.__version__<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.0in">2.6.1<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.0in">>>><br>
<br>
<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.0in;text-indent:-.25in;mso-list:l0 level2 lfo1">
<![if !supportLists]><span style="mso-list:Ignore">c.<span style="font:7.0pt "Times New Roman"">      
</span></span><![endif]>If I attempt this from IronPython with the following code (instead of importing killerbee):<br>
<br>
engine.ImportModule("Crypto.Cipher.AES");<br>
<br>
I get the same error (“cannot import _AES from Crypto.Cipher”).<br>
<br>
<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.0in;text-indent:-.25in;mso-list:l0 level2 lfo1">
<![if !supportLists]><span style="mso-list:Ignore">d.<span style="font:7.0pt "Times New Roman"">     
</span></span><![endif]>If I attempt to just import Crypto.Cipher (“engine.ImportModule("Crypto.Cipher");”) there are no errors.<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal">Before I start trying increasingly complicated workarounds, does anyone have an idea as to the possible root cause? I’ve searched around on the Internet generally and in outstanding IronPython issues specifically for other people with this
 problem, but I’ve only found the following semi-related hits around IronPython and pycrypto:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l1 level1 lfo2"><![if !supportLists]><span style="font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]><a href="http://stackoverflow.com/questions/2365661/how-to-create-a-package-in-c-sharp-for-use-in-ironpython">http://stackoverflow.com/questions/2365661/how-to-create-a-package-in-c-sharp-for-use-in-ironpython</a><o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l1 level1 lfo2"><![if !supportLists]><span style="font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]><a href="http://www.pyinstaller.org/ticket/881">http://www.pyinstaller.org/ticket/881</a><o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l1 level1 lfo2"><![if !supportLists]><span style="font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]><a href="http://lists.ironpython.com/pipermail/users-ironpython.com/2006-November/018956.html">http://lists.ironpython.com/pipermail/users-ironpython.com/2006-November/018956.html</a><o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l1 level1 lfo2"><![if !supportLists]><span style="font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">        
</span></span></span><![endif]><a href="https://bitbucket.org/mvdk/ironpycrypto">https://bitbucket.org/mvdk/ironpycrypto</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The relevant parts of the source look like this:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">using IronPython;<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">using IronPython.Hosting;<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">using Microsoft.Scripting;<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">using Microsoft.Scripting.Hosting;<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">ScriptEngine engine = Python.CreateEngine();<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">var paths = engine.GetSearchPaths();<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">paths.Add(@"/usr/lib/python2.7/site-packages/");<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">engine.SetSearchPaths(paths);<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">engine.ImportModule("Crypto.Cipher.AES");<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks for your time! I’m happy to provide any other details or source code necessary to continue debugging.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Baron<o:p></o:p></p>
</div>
</body>
</html>