title: Python FileNotFound
body: <p>I am fairly new to python.</p>
  
  <p>I am trying to make a script that will read sudoku solutions and determent if they are correct or not.</p>
  
  <p><strong>Things I need:</strong></p>
  
  <p>1] Prompt the user to enter a file/file path which includes the sudoku numbers. Its a .txt file of 9 rows and columns. Consist only of numbers.</p>
  
  <p>2] Have some kind of an error handling.</p>
  
  <p>3] Then, if the sudoku is valid, i should create a new text file using the same format as the original input file with the prefix "Correct_"</p>
  
  <p>I have not fully finished the program, but  I get this error when I put a false path or file name.</p>
  
  <pre><code> Hello to Sudoku valitator,
  
   Please type in the path to your file and press 'Enter': example.txt #This is a non existing file, to test the Error Exception
      'Traceback (most recent call last):
    File "C:/Users/FEDROS/Desktop/bs.py", line 9, in &lt;module&gt;
      sudoku = open(prompt, 'r').readlines()
  FileNotFoundError: [Errno 2] No such file or directory: 'example.txt'
  </code></pre>
  
  <p><strong>Here is my script:</strong></p>
  
  <pre><code>while True:
      try:
          prompt = input("\n Hello to Sudoku valitator,"
      "\n \n Please type in the path to your file and press 'Enter': ")
          break
      except (FileNotFoundError, IOError):
          print("Wrong file or file path")
  
  sudoku = open(prompt, 'r').readlines()
  
  def check(game):
      n = len(game)
      if n &lt; (1):
          return False
  
      for i in range(0, n):
          horizontal = []
          vertical = []
          for k in range(0, n):
  
              if game[k][i] in vertical:
                  return ("File checked for errors. Your options are wrong!")
              vertical.append(game[k][i])
  
              if game[i][k] in horizontal:
                  return ("File checked for errors. Your options are wrong!")
              horizontal.append(game[i][k])
      return ("File checked for errors. Your options are correct!")
  
  print (check(sudoku))
  </code></pre>
  
  <p>Thanks, any advice or help will be appreciated. </p>