Skip to content
Snippets Groups Projects
Commit 2a25cb4c authored by Holger Nahrstaedt's avatar Holger Nahrstaedt
Browse files

Fix python 2.7

Use threading only if futures is installed.
parent 614c1774
No related branches found
No related tags found
No related merge requests found
...@@ -117,6 +117,13 @@ Documentation is available at http://beem.readthedocs.io/en/latest/ ...@@ -117,6 +117,13 @@ Documentation is available at http://beem.readthedocs.io/en/latest/
Changelog Changelog
========= =========
0.19.11
-------
* beem is appbase ready
* more examples added
* print_appbase_calls added
* https nodes can be used
0.19.10 0.19.10
------- -------
* Memo encryption/decryption fixed * Memo encryption/decryption fixed
......
...@@ -7,15 +7,20 @@ from future.utils import python_2_unicode_compatible ...@@ -7,15 +7,20 @@ from future.utils import python_2_unicode_compatible
from builtins import str from builtins import str
from builtins import range from builtins import range
from builtins import object from builtins import object
from concurrent.futures import ThreadPoolExecutor, wait, as_completed
import time import time
from .block import Block from .block import Block
from .blockchainobject import BlockchainObject from .blockchainobject import BlockchainObject
from beem.instance import shared_steem_instance from beem.instance import shared_steem_instance
from beembase.operationids import getOperationNameForId
from .amount import Amount from .amount import Amount
from datetime import datetime, timedelta from datetime import datetime, timedelta
import math import math
FUTURES_MODULE = None
if not FUTURES_MODULE:
try:
from concurrent.futures import ThreadPoolExecutor, wait, as_completed
FUTURES_MODULE = "futures"
except ImportError:
FUTURES_MODULE = None
@python_2_unicode_compatible @python_2_unicode_compatible
...@@ -180,7 +185,7 @@ class Blockchain(object): ...@@ -180,7 +185,7 @@ class Blockchain(object):
head_block = stop head_block = stop
else: else:
head_block = self.get_current_block_num() head_block = self.get_current_block_num()
if threading: if threading and FUTURES_MODULE:
pool = ThreadPoolExecutor(2) pool = ThreadPoolExecutor(2)
latest_block = 0 latest_block = 0
for blocknum in range(start, head_block + 1, thread_num): for blocknum in range(start, head_block + 1, thread_num):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment