Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # script A
- import os
- import time
- import cv2
- if __name__ == "__main__":
- root_dir = "."
- os.chdir(root_dir)
- directory = root_dir
- sensor_triggered = False
- try:
- while True:
- if sensor_triggered:
- out = get_output_from_sensor()
- timestamp = time.strftime("\%Y-%m-%dT%H%M%S%z")
- directory = root_dir + timestamp
- if not os.path.isdir(directory):
- os.mkdir(directory)
- else:
- first_index += len(os.listdir(directory))
- name_of_file = directory + "\output" + ".txt"
- cv2.imwrite(name_of_file, out)
- os.system("explorer " + directory)
- # script B
- if __name__ == "__main__":
- import argparse
- import os
- def command_line_args():
- arg_parser.add_argument("path", action="store")
- arg_parser.add_argument("id", action="store")
- return arg_parser
- def parse_args()@
- cmd_line = command_line_arguments()
- arg = cmd_line.parse_args()
- return arg.path, arg.id
- for file in os.listdir(path):
- # do stuff on that file
- print("Script B is done processing {} with ID {}".format(path, id))
- exit(0)
Add Comment
Please, Sign In to add comment