Commit e447d0c26afee9b164d4549dd0643b7d9c9bdb2c
1 parent
cb9f30b0
Exists in
master
and in
1 other branch
- reverted back to asyncio.get_event_loop() so that can run on python3.6
Showing
2 changed files
with
4 additions
and
2 deletions
Show diff stats
learnapp.py
@@ -26,7 +26,8 @@ logger = logging.getLogger(__name__) | @@ -26,7 +26,8 @@ logger = logging.getLogger(__name__) | ||
26 | # helper functions | 26 | # helper functions |
27 | # ============================================================================ | 27 | # ============================================================================ |
28 | async def _bcrypt_hash(a, b): | 28 | async def _bcrypt_hash(a, b): |
29 | - loop = asyncio.get_running_loop() | 29 | + # loop = asyncio.get_running_loop() # FIXME python 3.7 only |
30 | + loop = asyncio.get_event_loop() | ||
30 | return await loop.run_in_executor(None, bcrypt.hashpw, a.encode('utf-8'), b) | 31 | return await loop.run_in_executor(None, bcrypt.hashpw, a.encode('utf-8'), b) |
31 | 32 | ||
32 | async def check_password(try_pw, pw): | 33 | async def check_password(try_pw, pw): |
questions.py
@@ -52,7 +52,8 @@ class Question(dict): | @@ -52,7 +52,8 @@ class Question(dict): | ||
52 | return 0.0 | 52 | return 0.0 |
53 | 53 | ||
54 | async def correct_async(self): | 54 | async def correct_async(self): |
55 | - loop = asyncio.get_running_loop() | 55 | + # loop = asyncio.get_running_loop() # FIXME python 3.7 only |
56 | + loop = asyncio.get_event_loop() | ||
56 | grade = await loop.run_in_executor(None, self.correct) | 57 | grade = await loop.run_in_executor(None, self.correct) |
57 | return grade | 58 | return grade |
58 | 59 |