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.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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)