Description
mkpl fails to create playlist if filenames have characters such as Ε
Some file names may have other character set / encodings (found in non english languages) and these characters seem to crash mkpl - the error is only apparent if you enable verbose output (-v). If verbose is not enabled, it will say the playlist argument is not defined.
Example output (Windows):
mkpl -d c:\temp\ -v test.m3u
debug: formats={'aiff', 'mp2', 'avi', 'mp1', 'm4a', 'alac', 'mp3', 'wmv', 'opus', 'xvid', 'wma', 'wav', 'ogg', 'mpg', 'mov', 'mpeg', 'divx', 'mp4', 'flac', 'aac'}, recursive=False, pattern=.*, split=False
debug: current directory=c:\temp, root=c:
debug: add multimedia file temp\Test - Ε.mp3
debug: write playlist test.m3u
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\keef\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts\mkpl.exe_main.py", line 7, in
File "C:\Users\keef\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mkpl.py", line 345, in main
_process_playlist(multimedia_files, args)
File "C:\Users\keef\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mkpl.py", line 301, in _process_playlist
write_playlist(other_playlist if other_playlist else cli_args.playlist,
File "C:\Users\keef\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mkpl.py", line 182, in write_playlist
pl.write(joined_string.join(files[ext_part:max_tracks]) + end_file_string)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1008.0_x64__qbz5n2kfra8p0\Lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode character '\u014d' in position 12: character maps to
Steps to Reproduce
Try to create a playlist from a directory which contains a filename having non english characters such as Ε
Line of code
Unknown
Expected Behaviour
- Better error handling - it should skip any problematic files and move on to the next
- Preferably, allow these file names to be added to the playlist
Your Environment
Python 3.11
- mkpl version used: 1.6.0
- Operating System and version: Windows 11
Additional context