readbeyond / aeneas

aeneas is a Python/C library and a set of tools to automagically synchronize audio and text (aka forced alignment)
http://www.readbeyond.it/aeneas/
GNU Affero General Public License v3.0
2.44k stars 218 forks source link

Is anybody can help me figure out this anoying encoding issue? #290

Open enponder opened 1 year ago

enponder commented 1 year ago

The following is my code:

C:\Users\Admin>python -m aeneas.tools.execute_task "F:\a.mp3" "F:\b.txt" "task_language=eng|is_text_type=plain|os_task_file_format=json" output/sonnet.json
[WARN] The default input encoding is not UTF-8.
[WARN] You might want to set 'PYTHONIOENCODING=UTF-8' in your shell.
[WARN] The default output encoding is not UTF-8.
[WARN] You might want to set 'PYTHONIOENCODING=UTF-8' in your shell.
[ERRO] Unable to read file 'F:\a.mp3'
[ERRO] Make sure the file path is written/escaped correctly and that you have read permission on it

Yeah, Maybe you have noted that the fucking warning called UTF-8. I tried a countless times to solve the fucking "UTF-8" issue, but I alway fail to slove it from modifying the computer registry to modifying environment variables and more. I don't eat or drink for servral days to focusing on fix it and still can't fix it, I'm going to break down now. Due to this encoding issue, I can't run aeneas on my commandline. Can anybody help me. I will always be greatfull.

ozdefir commented 1 year ago

The UTF-8 warning isn't the problem. I think it's a leftover from Python 2. You can ignore it for now. Your real problem is about the file locations. If your mp3 and txt files are in a USB disk, maybe they are corrupted. Try copying those files to somewhere in C:, change the command line arguments accordingly and run it again.

enponder commented 1 year ago

The UTF-8 warning isn't the problem. I think it's a leftover from Python 2. You can ignore it for now. Your real problem is about the file locations. If your mp3 and txt files are in a USB disk, maybe they are corrupted. Try copying those files to somewhere in C:, change the command line arguments accordingly and run it again.

The version I installed is integrated installation. The link is here: https://github.com/sillsdev/aeneas-installer/releases. I think that the file location problem you said is no problem: the audio file and the txt file can normally play, and then the hard drive is a solid state drive plugged into my computer, not a USB disk. I just copy these file to the the root of C and this version, but it's still receive the same warning. Maybe I should change the aeneas version

ozdefir commented 1 year ago

Then, it might be the backslashes ("\") in the input paths causing the problem. As a workaround, you can try using forward slashes instead, as Windows command line accepts that too :

python -m aeneas.tools.execute_task "F:/a.mp3" "F:/b.txt" "task_language=eng|is_text_type=plain|os_task_file_format=json" output/sonnet.json

I'm not on a Windows machine, so I can't check whether python on Windows handles it correctly. If it doesn't work, another alternative would be to run aeneas from the same folder as the input files and to use relative paths instead of absolute paths:

C:\Users\Admin>F:
F:\>python -m aeneas.tools.execute_task "a.mp3" "b.txt" "task_language=eng|is_text_type=plain|os_task_file_format=json" output/sonnet.json