This repository has been archived by the owner on Oct 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
[WIP] use python3 and add more instructions on README #4
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(dfs)~/dev/etc/ecip1017test dev *% ⟠ ./bin/status.py Nodes status IDPEERSHEIGHTHASH Traceback (most recent call last): File ./bin/status.py, line 70, in <module> list() File ./bin/status.py, line 64, in list height = api.get_height(pod_id) File /Users/ia/dev/etc/ecip1017test/bin/rpc_api.py, line 23, in get_height return self.rpc_call(node_id, eth_blockNumber, []) File /Users/ia/dev/etc/ecip1017test/bin/rpc_api.py, line 66, in rpc_call if not x.has_key(result): AttributeError: 'dict' object has no attribute 'has_key' ---- solution: dont use method, just check for nil on dict key
(dfs)~/dev/etc/ecip1017test dev *% ⟠ ./bin/verify.py Verify blockchain state.... ------------------------------------------- Download blockchain for local analysis.... (blocks 1..49, it may take 5+ minutes) Traceback (most recent call last): File ./bin/verify.py, line 150, in <module> state.download() File ./bin/verify.py, line 67, in download self.state = reduce(reduce_state, blocks, defaultdict(lambda: 0)) NameError: name 'reduce' is not defined ---- solution: import from functools
(dfs)~/dev/etc/ecip1017test dev *% ⟠ ./bin/verify.py Verify blockchain state.... ------------------------------------------- Download blockchain for local analysis.... (blocks 1..56, it may take 5+ minutes) Traceback (most recent call last): File ./bin/verify.py, line 151, in <module> state.download() File ./bin/verify.py, line 68, in download self.state = reduce(reduce_state, blocks, defaultdict(lambda: 0)) File ./bin/verify.py, line 110, in reduce_state base += era.get_block_reward() File ./bin/verify.py, line 39, in get_block_reward return toWei(coef(5.0, self.era)) File ./bin/verify.py, line 23, in toWei val = long(ether * ETHER) NameError: name 'long' is not defined ---- solution: use int instead https://stackoverflow.com/questions/14904814/nameerror-global-name-long-is-not-defined
(dfs)~/dev/etc/ecip1017test dev *% ⟠ ./bin/verify.py Verify blockchain state.... ------------------------------------------- Download blockchain for local analysis.... (blocks 1..93, it may take 5+ minutes) Done ------------------------------------------- ------------------------------------------- Mining stats: ------------------------------------------- Expected state: Miner 0x479f3307a0e40a8cd8b772e17ec9f809e0dd03ad should have 25000000000000000000 Miner 0x895b2a4a1beffc42f0eb28fb9be9d8d4478c011f should have 4.4015625e+20 ------------------------------------------- ------------------------------------------- Verifying... Invalid balance for miner 0x479f3307a0e40a8cd8b772e17ec9f809e0dd03ad: 25.0 != 28.0 (exp != act) 0x15af1d78b58c40000 wei != 0x18efc84ad0c7b0000 wei Traceback (most recent call last): File ./bin/verify.py, line 153, in <module> state.verify() File ./bin/verify.py, line 97, in verify if abs(toEther(hex(balance)) - toEther(act)) > 0: TypeError: 'float' object cannot be interpreted as an integer ---- solution: cast balance as int
I'm not actually sure about Python 3. AFAIK Python 2 is still standard for most systems. Do you think it will work with both version after this change? |
I don't know -- I guess it might not. I switched to a virtualenv with 3.5 to fix #3 from my 2.7.13 OS default. What version are you at? -- We might want to consider adding a docker container to run the scripts in order to avoid exactly these annoying issues. |
for my macos I have python 2.7 as default, and python 3 under |
I can't get around #3 without using 3.5... here's my python context for reference
Similar to yours? |
|
|
now we see why python got replaced by golang ;) |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR currently just for sharing/reference