Forum Discussion

mcretacci's avatar
New Contributor
9 months ago

Testing with text files


i was wondering if anyone has tried testing with log files. im creating a test that looks over text files and put a parameter if the logfile is less than or greater than the value put. this is the code i have so far but it keeps giving me an error with the script im making. Any thoughts or ideas on how i can make this happen?


import sys
import os
import aq
def read_text_file_and_test(file_path):
       with open(file_path, 'r') as file:
if __name__ == "__main__":
   if len(sys.argv) != 2:
       print("Usage: python <path_to_text_file>")
   text_file_path = sys.argv[1]
   if not os.path.isfile(text_file_path):
       print("The provided file does not exist.")

6 Replies