File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 3737from docopt import DocoptExit , docopt
3838from prompt_toolkit import PromptSession
3939from prompt_toolkit .completion import Completer , Completion
40- from prompt_toolkit .eventloop import use_asyncio_event_loop
40+ from prompt_toolkit import __version__ as ptk_version
41+ PTK3 = ptk_version .startswith ('3.' )
42+ if not PTK3 :
43+ from prompt_toolkit .eventloop import use_asyncio_event_loop
4144from prompt_toolkit .history import FileHistory
4245from prompt_toolkit .patch_stdout import patch_stdout
4346
@@ -1631,7 +1634,10 @@ async def _run(self, commands):
16311634
16321635 for line in commands :
16331636 if line is None :
1634- line = await self .session .prompt ("{}> " .format (self .uuid ), async_ = True )
1637+ if PTK3 :
1638+ line = await self .session .prompt_async ("{}> " .format (self .uuid ))
1639+ else :
1640+ line = await self .session .prompt ("{}> " .format (self .uuid ), async_ = True )
16351641
16361642 if not line .strip ():
16371643 continue
@@ -1700,7 +1706,8 @@ def main():
17001706 -h --help Show this help message and exit
17011707 --version Show version and exit
17021708 """
1703- use_asyncio_event_loop ()
1709+ if not PTK3 :
1710+ use_asyncio_event_loop ()
17041711 arguments = docopt (doc , version = "stat_checker 0.5" )
17051712
17061713 logging .basicConfig (
You can’t perform that action at this time.
0 commit comments