79212463

Date: 2024-11-21 18:20:30
Score: 0.5
Natty:
Report link

Inside board.py, don't just open the bare filename "words.txt".

Instead, use the __file__ variable to get the full pathname of the current python file, and use that to construct the full path to the words.txt file.

this_directory = os.path.dirname(__file__)
words_file = os.path.join(this_directory, "words.txt")
with open(words_file) as file:
    ...

Was this approach not obvious from the duplicate answer?

Reasons:
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Looks like a comment (1):
  • High reputation (-2):
Posted by: John Gordon