Guest User

Untitled

a guest
Feb 17th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. # script A
  2. import os
  3. import time
  4. import cv2
  5.  
  6. if __name__ == "__main__":
  7.  
  8. root_dir = "."
  9. os.chdir(root_dir)
  10. directory = root_dir
  11.  
  12. sensor_triggered = False
  13.  
  14. try:
  15. while True:
  16. if sensor_triggered:
  17. out = get_output_from_sensor()
  18. timestamp = time.strftime("\%Y-%m-%dT%H%M%S%z")
  19. directory = root_dir + timestamp
  20.  
  21. if not os.path.isdir(directory):
  22. os.mkdir(directory)
  23. else:
  24. first_index += len(os.listdir(directory))
  25.  
  26. name_of_file = directory + "\output" + ".txt"
  27. cv2.imwrite(name_of_file, out)
  28.  
  29. os.system("explorer " + directory)
  30.  
  31. # script B
  32. if __name__ == "__main__":
  33.  
  34. import argparse
  35. import os
  36.  
  37. def command_line_args():
  38. arg_parser.add_argument("path", action="store")
  39. arg_parser.add_argument("id", action="store")
  40. return arg_parser
  41.  
  42. def parse_args()@
  43. cmd_line = command_line_arguments()
  44. arg = cmd_line.parse_args()
  45. return arg.path, arg.id
  46.  
  47. for file in os.listdir(path):
  48. # do stuff on that file
  49.  
  50. print("Script B is done processing {} with ID {}".format(path, id))
  51. exit(0)
Add Comment
Please, Sign In to add comment