0

I have the same problem as in 'How to apply pyethrecover.py on v3 .json/transfor v3 .json to .v1' referenced here, but in trying the answer's code, I am finding that the Crypto package is not being recognized.

I installed 'Crypto' from within PyCharm and it reports installing (i.e. notification and event logs), but the IDE still shows this it as an 'Unresolved Reference' and produces the error below while running utils.py:

try:
    from Crypto.Hash import keccak
    sha3_256 = lambda x: keccak.new(digest_bits=256, data=x).digest()
except ImportError:
    import sha3 as _sha3
    sha3_256 = lambda x: _sha3.keccak_256(x).digest()

AttributeError: 'module' object has no attribute 'keccak_256'

What am I missing? I am using Python 2.7.10 in PyCharm. Thanks.

1

This is more than likely a PyCharm issue, rather than anything related to Ethereum Python code.

You'll need to ensure the Unresolved reference error is resolved before the Crypto package can be used. See this StackOverflow question for steps to overcome this.

(The actual runtime error you're hitting is because you're entering the except path, and sha3 is either not present, or also not resolving.)

  • Thanks for the pointer! I'll work that way and report back what I find. – Bill LaPrise Jun 4 '17 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.