Answer the question
In order to leave comments, you need to log in
Problem with python encoding?
There is a day of victory 2.m3u8 file with reports of the following structure:
Z:\Радио\75 лет Победы - 1\75 лет Победы - 1\Сюжет 2 Федоринов.mp3
Z:\Радио\75 лет Победы - 1\75 лет Победы - 1\Сюжет 3 Сад Пионеров.mp3
Z:\Радио\75 лет Победы - 1\75 лет Победы - 1\Сюжет 4 Шейникова.mp3
Z:\Радио\75 лет Победы - 1\75 лет Победы - 1\Сюжет 5 В землянке.mp3
Z:\Радио\75 лет Победы - 1\75 лет Победы - 1\Сюжет 6 Божко.mp3
Z:\Радио\75 лет Победы - 1\75 лет Победы - 1\Сюжет 7 Чеботарёва.mp3
Z:\Радио\75 лет Победы - 1\75 лет Победы - 1\Сюжет 8 Песчаный лог.mp3
print('hello world!')
from mutagen.mp3 import MP3
ff = open('D:\\git\\Tropic-Island\\Tropic-Island\\Java\\Projects\\Example\\day of victory 2.m3u8', 'r')
array_of_strings = ff.read().split('\n')
ff.close()
ff = open('D:\\git\\Tropic-Island\\Tropic-Island\\Java\\Projects\\Example\\day of victory 3.m3u8','w')
for i in range(len(array_of_strings)):
f = MP3(array_of_strings[i])
ff.write(array_of_strings[i]+'\n')
ff.write(str(f.info.length)+'\n')
ff.close()
print('hello world!')
C:\Users\User\AppData\Local\Programs\Python\Python38-32\python.exe C:/Users/User/.PyCharmCE2019.1/config/scratches/scratch.py
hello world!
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mutagen\_util.py", line 235, in _openfile
fileobj = open(filename, "rb+" if writable else "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'Z:\\Р\xa0адио\\75 лет Победы - 1\\75 лет Победы - 1\\Сюжет 2 Федоринов.mp3'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/User/.PyCharmCE2019.1/config/scratches/scratch.py", line 8, in <module>
f = MP3(array_of_strings[i])
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mutagen\_file.py", line 49, in __init__
self.load(*args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mutagen\_util.py", line 138, in wrapper
with _openfile(self, filething, filename, fileobj,
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\contextlib.py", line 113, in __enter__
return next(self.gen)
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mutagen\_util.py", line 256, in _openfile
raise MutagenError(e)
mutagen.MutagenError: [Errno 2] No such file or directory: 'Z:\\Р\xa0адио\\75 лет Победы - 1\\75 лет Победы - 1\\Сюжет 2 Федоринов.mp3'
Process finished with exit code 1
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question