<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
So now I am answering my own question <doh> (after looking at reply I just sent you)<div><br></div><div>The issue with the below would appear to be that 'common' is a file (hence not a package</div><div>with a __init__.py to define it) in the same directory.</div><div><br></div><div>So now my question is, how do you import from a file within the same path.</div><div>Scenario is, directory path looks like:</div><div><br></div><div>Crypto - > SelfTest -> Cipher -> test_AES.py</div><div>Crypto - > SelfTest -> Cipher -> common.py</div><div><br></div><div>And here test_AES.py has the line: from .common import make_block_tests</div><div><br></div><div>If I change this back to the original from Python 2.x version (ie remove the dot) how do we </div><div>know if it calls the correct common.py as it exists in several directories?</div><div><br></div><div>The other alternative I thought of was a full path import:</div><div><br></div><div>from Crypto.SelfTest.Cipher.common import make_block_tests</div><div><br></div><div>but not sure this is correct either???</div><div><br></div><div>Grail</div><div><br><hr id="stopSpelling">From: grail69@hotmail.com<br>To: pycrypto@lists.dlitz.net<br>Date: Wed, 17 Mar 2010 05:09:52 +0000<br>Subject: Re: [pycrypto] Pycrypto working with python 3.0 or 3.1<br><br>
<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</style>
Hi Christoph<div><br></div><div>Yes I am running into this issue as well. Another similar one is where</div><div>2to3 suggests the following change:</div><div><br></div><div>from common import make_block_tests</div><div><br></div><div>to</div><div><br></div><div>from <font class="ecxApple-style-span" color="#FF0000">.</font>common import make_block_tests </div><div><br></div><div>In case hard top see the change is to add a full-stop at the start of common which makes this</div><div>a relative path reference. The error I get after making this change is:</div><div><br></div><div><span class="ecxApple-style-span" style="font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;font-size:14px;border-collapse:collapse;line-height:18px">ValueError: Attempted relative import in non-package</span></div><div><font class="ecxApple-style-span" face="Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif" size="4"><span class="ecxApple-style-span" style="border-collapse:collapse;font-size:14px;line-height:18px"><br></span></font></div><div><font class="ecxApple-style-span" face="Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif" size="4"><span class="ecxApple-style-span" style="border-collapse:collapse;font-size:14px;line-height:18px">So I am trying to get this working as well. Let me know how you go?</span></font></div><div><font class="ecxApple-style-span" face="Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif" size="4"><span class="ecxApple-style-span" style="border-collapse:collapse;font-size:14px;line-height:18px"><br></span></font></div><div><font class="ecxApple-style-span" face="Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif" size="4"><span class="ecxApple-style-span" style="border-collapse:collapse;font-size:14px;line-height:18px">Cheers</span></font></div><div><font class="ecxApple-style-span" face="Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif" size="4"><span class="ecxApple-style-span" style="border-collapse:collapse;font-size:14px;line-height:18px">Grail<br></span></font><br><br></div></div>                                            <br /><hr />Meet local singles online. <a href='http://clk.atdmt.com/NMN/go/150855801/direct/01/' target='_new'>Browse profiles for FREE!</a></body>
</html>