Skip to content

Fixed main.py: Correct file reading and JSON formatting#399

Open
217785-collab wants to merge 1 commit intoagwaBom:mainfrom
217785-collab:main
Open

Fixed main.py: Correct file reading and JSON formatting#399
217785-collab wants to merge 1 commit intoagwaBom:mainfrom
217785-collab:main

Conversation

@217785-collab
Copy link
Copy Markdown

@217785-collab 217785-collab commented Nov 19, 2025

Error 1: Fixed path_to_file_list (lines 4–7)

  1. Changed open(path, 'w') → open(path, 'r') because 'w' wipes the file and prevents reading.
  2. Fixed return lines → proper list comprehension.

Error 2: Fixed JSON generation in train_file_list_to_json

  1. Removed incorrect conditions like if '/' or '"' in file: which always evaluate to true.
  2. Replaced broken template-based JSON with json.dumps.
  3. Corrected incorrect variable overwrite: english_file = process_file(german_file).

Error 3: Fixed write_file_list (lines 27–31)

  1. Changed open(path, 'r') → open(path, 'w') because writing was impossible.
  2. Added actual writing of the content (f.write(line + "\n")).

Error 4: Fixed the main function logic

  1. Original code passed wrong arguments to functions and used wrong return values.
  2. Replaced with correct calls:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant