bjornedstrom / python-sha3

Python implementation of FIPS SHA3 and SHAKE
Other
44 stars 20 forks source link

_sha3.sha3() return Attribute Error #6

Open szmontsaroff opened 6 years ago

szmontsaroff commented 6 years ago

After install sha3, and running it with a received package under Mac OS 10.13.2, when the calling library reference
self._s = _sha3.sha3() AttributeError: module '_sha3' has no attribute 'sha3'

Below is the stack dump

Traceback (most recent call last): File "/usr/local/bin/indy", line 4, in import('pkg_resources').run_script('indy-node==1.2', 'indy') File "/usr/local/lib/python3.6/site-packages/pkg_resources/init.py", line 748, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/local/lib/python3.6/site-packages/pkg_resources/init.py", line 1517, in run_script exec(code, namespace, namespace) File "/usr/local/lib/python3.6/site-packages/indy_node-1.2-py3.6.egg/EGG-INFO/scripts/indy", line 40, in from indy_client.cli.cli import IndyCli File "/usr/local/lib/python3.6/site-packages/indy_node-1.2-py3.6.egg/indy_client/cli/cli.py", line 27, in from indy_client.agent.walleted_agent import WalletedAgent File "/usr/local/lib/python3.6/site-packages/indy_node-1.2-py3.6.egg/indy_client/agent/walleted_agent.py", line 7, in from indy_client.agent.agent import Agent File "/usr/local/lib/python3.6/site-packages/indy_node-1.2-py3.6.egg/indy_client/agent/agent.py", line 12, in from indy_client.client.client import Client File "/usr/local/lib/python3.6/site-packages/indy_node-1.2-py3.6.egg/indy_client/client/client.py", line 9, in from plenum.client.client import Client as PlenumClient File "/usr/local/lib/python3.6/site-packages/indy_plenum-1.2.29-py3.6.egg/plenum/client/client.py", line 49, in from state.pruning_state import PruningState File "/usr/local/lib/python3.6/site-packages/indy_plenum-1.2.29-py3.6.egg/state/pruning_state.py", line 6, in from state.trie.pruning_trie import BLANK_ROOT, Trie, BLANK_NODE, \ File "/usr/local/lib/python3.6/site-packages/indy_plenum-1.2.29-py3.6.egg/state/trie/pruning_trie.py", line 196, in BLANK_ROOT = sha3rlp(BLANK_NODE) File "/usr/local/lib/python3.6/site-packages/indy_plenum-1.2.29-py3.6.egg/state/util/utils.py", line 328, in sha3rlp return sha3(rlp.encode(x)) File "/usr/local/lib/python3.6/site-packages/indy_plenum-1.2.29-py3.6.egg/state/util/utils.py", line 159, in sha3 return sha3_256(to_string(seed)) File "/usr/local/lib/python3.6/site-packages/indy_plenum-1.2.29-py3.6.egg/state/util/utils.py", line 8, in sha3_256 return _sha3.sha3_256(x).digest() File "/usr/local/lib/python3.6/site-packages/sha3-0.2.1-py3.6-macosx-10.13-x86_64.egg/sha3/init.py", line 97, in sha3_256 return SHA3256(s) File "/usr/local/lib/python3.6/site-packages/sha3-0.2.1-py3.6-macosx-10.13-x86_64.egg/sha3/init.py", line 30, in init self._s = _sha3.sha3() AttributeError: module '_sha3' has no attribute 'sha3'

bjornedstrom commented 6 years ago

Hi.

Try to import sha3 instead.

Do

self._s = sha3.sha3() # no underscore

instead of

self._s = _sha3.sha3()

The module with the underscore in front is the low level C module and should not be called directly

Take care

szmontsaroff commented 6 years ago

I think I was unclear.

The error occured in the python module /usr/local/lib/python3.6/site-packages/sha3-0.2.1-py3.6-macosx-10.13-x86_64.egg/sha3/init.py.

I have a suspicion that I am running into some compiler issues on the mac which are not generating the _sha3.cpython-36m-darwin.so correctly. (I have both gcc and the Mac compilers)

Björn Edström wrote on 1/18/18 2:21 AM:

Hi.

Try to import sha3 instead.

Do

self._s = sha3.sha3() # no underscore

instead of

self._s = _sha3.sha3()

The module with the underscore in front is the low level C module and should not be called directly

Take care

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/bjornedstrom/python-sha3/issues/6#issuecomment-358602790, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFjOJKXEHhif8UZHmHT8q87cEoIQ2BH3ks5tLxtCgaJpZM4RiNLd.


    [cid:part4.4DE3EAC1.4FC03AEA@luxoft.com]

Stephen Montsaroff Advanced Technologies Team smontsaroff@luxoft.commailto:smontsaroff@luxoft.com C: 206 437 2427


This e-mail and any attachment(s) are intended only for the recipient(s) named above and others who have been specifically authorized to receive them. They may contain confidential information. If you are not the intended recipient, please do not read this email or its attachment(s). Furthermore, you are hereby notified that any dissemination, distribution or copying of this e-mail and any attachment(s) is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender by replying to this e-mail and then delete this e-mail and any attachment(s) or copies thereof from your system. Thank you.

szmontsaroff commented 6 years ago

the call which triggered it is return _sha3.sha3_256(x).digest()

Montsaroff, Stephen wrote on 1/18/18 10:25 AM: I think I was unclear.

The error occured in the python module /usr/local/lib/python3.6/site-packages/sha3-0.2.1-py3.6-macosx-10.13-x86_64.egg/sha3/init.py.

I have a suspicion that I am running into some compiler issues on the mac which are not generating the _sha3.cpython-36m-darwin.so correctly. (I have both gcc and the Mac compilers)

Björn Edström wrote on 1/18/18 2:21 AM:

Hi.

Try to import sha3 instead.

Do

self._s = sha3.sha3() # no underscore

instead of

self._s = _sha3.sha3()

The module with the underscore in front is the low level C module and should not be called directly

Take care

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/bjornedstrom/python-sha3/issues/6#issuecomment-358602790, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFjOJKXEHhif8UZHmHT8q87cEoIQ2BH3ks5tLxtCgaJpZM4RiNLd.


    [X]

Stephen Montsaroff Advanced Technologies Team smontsaroff@luxoft.commailto:smontsaroff@luxoft.com C: 206 437 2427


    [cid:part6.F23AF517.F37BD974@luxoft.com]

Stephen Montsaroff Advanced Technologies Team smontsaroff@luxoft.commailto:smontsaroff@luxoft.com C: 206 437 2427


This e-mail and any attachment(s) are intended only for the recipient(s) named above and others who have been specifically authorized to receive them. They may contain confidential information. If you are not the intended recipient, please do not read this email or its attachment(s). Furthermore, you are hereby notified that any dissemination, distribution or copying of this e-mail and any attachment(s) is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender by replying to this e-mail and then delete this e-mail and any attachment(s) or copies thereof from your system. Thank you.