tag 638166 + moreinfo
thanks

On 08/17/2011 11:13 AM, GODART Christophe (MORPHO) wrote:
> $ python
> Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) 
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import paramiko
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/share/pyshared/paramiko/__init__.py", line 69, in <module>
>     from transport import randpool, SecurityOptions, Transport
>   File "/usr/share/pyshared/paramiko/transport.py", line 32, in <module>
>     from paramiko import util
>   File "/usr/share/pyshared/paramiko/util.py", line 32, in <module>
>     from paramiko.common import *
>   File "/usr/share/pyshared/paramiko/common.py", line 98, in <module>
>     from rng import StrongLockingRandomPool
>   File "/usr/share/pyshared/paramiko/rng.py", line 23, in <module>
>     from Crypto.Util.randpool import RandomPool as _RandomPool
>   File "/usr/share/pyshared/Crypto/Util/randpool.py", line 30, in <module>
>     import Crypto.Random
>   File "/usr/share/pyshared/Crypto/Random/__init__.py", line 29, in <module>
>     import _UserFriendlyRNG
>   File "/usr/share/pyshared/Crypto/Random/_UserFriendlyRNG.py", line 36, in 
> <module>
>     from Crypto.Random.Fortuna import FortunaAccumulator
>   File "/usr/share/pyshared/Crypto/Random/Fortuna/FortunaAccumulator.py", 
> line 34, in <module>
>     import SHAd256
>   File "/usr/share/pyshared/Crypto/Random/Fortuna/SHAd256.py", line 38, in 
> <module>
>     from Crypto.Hash import SHA256
> ImportError: cannot import name SHA256

Works for me.

> New try with just python-crypto:
> 
>>>> from Crypto.Hash import SHA256
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: cannot import name SHA256

Works again.

So I need some more information. It seems that your sys.path doesn't include
/usr/lib/python2.6/dist-packages. Otherwise the module should be found. How does
your sys.path look like?

> Then, trying to import just the SHA256 module from its directory:
> 
> $ cd /usr/lib/python2.6/dist-packages/Crypto/Hash
> $ python
> Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) 
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import SHA256
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> SystemError: dynamic module not initialized properly

That's expected as the module is named Crypto.Hash.SHA256 so you can't just
import it as SHA256.

Kind regards,
-- 
Sebastian Ramacher

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to