Guest User

Untitled

a guest
Feb 17th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. # main script
  2. import os
  3. import cv2
  4. import time
  5. from other_script import *
  6.  
  7. if __name__ == "__main__":
  8. while True:
  9. if some_event_triggered:
  10. directory = "." + time.strftime("\%Y-%m-%dT%H%M%S%z")
  11. if not os.path.isdir(directory):
  12. os.mkdir(directory)
  13.  
  14. # assuming images are given
  15. for num, img in enumerate(images):
  16. name_of_file = directory + "\img_num" + str(num) + ".jpg"
  17. cv2.imwrite(name_of_file, img)
  18.  
  19. do_work(timestamp) # call do_work for this directory but continue 'listening' for a new event trigger
  20.  
  21. # other_script.py
  22. import os
  23.  
  24. def do_work(timestamp):
  25. directory = os.path.join(os.getcwd(), + timestamp)
  26. # do some work on that directory
Add Comment
Please, Sign In to add comment