1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<tt>
<html><br>
<head><br>
<style><!--<br>
.hmmessage P<br>
{<br>
margin:0px;<br>
padding:0px<br>
}<br>
body.hmmessage<br>
{<br>
font-size: 10pt;<br>
font-family:Verdana<br>
}<br>
--></style><br>
</head><br>
<body class='hmmessage'><br>
So now I am answering my own question &lt;doh&gt; (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 - &gt; SelfTest -&gt; Cipher -&gt; test_AES.py</div><div>Crypto - &gt; SelfTest -&gt; Cipher -&gt; 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&nbsp;</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><br>
<br>
<br>
<br>
<style><br>
.ExternalClass .ecxhmmessage P<br>
{padding:0px;}<br>
.ExternalClass body.ecxhmmessage<br>
{font-size:10pt;font-family:Verdana;}<br>
</style><br>
<br>
<br>
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&nbsp;</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><br>
</html>
</tt>
|