[pycrypto] Pycrypto working with python 3.0 or 3.1

Grail Dane grail69 at hotmail.com
Tue Mar 16 23:26:18 CST 2010


So now I am answering my own question <doh> (after looking at reply I just sent you)
The issue with the below would appear to be that 'common' is a file (hence not a packagewith a __init__.py to define it) in the same directory.
So now my question is, how do you import from a file within the same path.Scenario is, directory path looks like:
Crypto - > SelfTest -> Cipher -> test_AES.pyCrypto - > SelfTest -> Cipher -> common.py
And here test_AES.py has the line: from .common import make_block_tests
If I change this back to the original from Python 2.x version (ie remove the dot) how do we know if it calls the correct common.py as it exists in several directories?
The other alternative I thought of was a full path import:
from Crypto.SelfTest.Cipher.common import make_block_tests
but not sure this is correct either???
Grail
From: grail69 at hotmail.com
To: pycrypto at lists.dlitz.net
Date: Wed, 17 Mar 2010 05:09:52 +0000
Subject: Re: [pycrypto] Pycrypto working with python 3.0 or 3.1








Hi Christoph
Yes I am running into this issue as well. Another similar one is where2to3 suggests the following change:
from common import make_block_tests
to
from .common import make_block_tests 
In case hard top see the change is to add a full-stop at the start of common which makes thisa relative path reference. The error I get after making this change is:
ValueError: Attempted relative import in non-package
So I am trying to get this working as well. Let me know how you go?
CheersGrail


 		 	   		  
_________________________________________________________________
Browse profiles for FREE! Meet local singles online.
http://clk.atdmt.com/NMN/go/150855801/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.dlitz.net/pipermail/pycrypto/attachments/20100317/12d450eb/attachment-0001.htm 


More information about the pycrypto mailing list