Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # main script
- import os
- import cv2
- import time
- from other_script import *
- if __name__ == "__main__":
- while True:
- if some_event_triggered:
- directory = "." + time.strftime("\%Y-%m-%dT%H%M%S%z")
- if not os.path.isdir(directory):
- os.mkdir(directory)
- # assuming images are given
- for num, img in enumerate(images):
- name_of_file = directory + "\img_num" + str(num) + ".jpg"
- cv2.imwrite(name_of_file, img)
- do_work(timestamp) # call do_work for this directory but continue 'listening' for a new event trigger
- # other_script.py
- import os
- def do_work(timestamp):
- directory = os.path.join(os.getcwd(), + timestamp)
- # do some work on that directory
Add Comment
Please, Sign In to add comment