Python-ELMO is a Python library which offers an encapsulation of the binary tool ELMO, in order to manipulate it easily in Python and SageMath script.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

run_server.py 618B

  1. from servicethread import ListeningThread
  2. from executorthread import ExecutorThread
  3. def do_main_program():
  4. global thread, stop
  5. thread = ListeningThread('localhost', 5000, ExecutorThread)
  6. thread.start()
  7. def program_cleanup(signum, frame):
  8. global thread, stop
  9. thread.stop()
  10. stop = True
  11. thread = None
  12. stop = False
  13. # Execute
  14. print("Executing...")
  15. do_main_program()
  16. print("Done ! And now, listening...")
  17. import signal
  18. signal.signal(signal.SIGINT, program_cleanup)
  19. signal.signal(signal.SIGTERM, program_cleanup)
  20. # Wait
  21. import time
  22. while not stop:
  23. time.sleep(1)