gmusic-playlist icon indicating copy to clipboard operation
gmusic-playlist copied to clipboard

Exporting playlists with forward slashes in them results in an error

Open nickfishman opened this issue 9 years ago • 1 comments

For example, I had a playlist named "Late nights/early mornings". Here's the error I got:

Traceback (most recent call last):
  File "ExportLists.py", line 99, in <module>
    playlist_handler(playlist_name, playlist_description, playlist_tracks)
  File "ExportLists.py", line 26, in playlist_handler
    open_log(os.path.join(output_dir,playlist_name+u'.log'))
  File "/Users/nf/workspace/gmusic-playlist/common.py", line 40, in open_log
    logfile = codecs.open(filename, encoding='utf-8', mode='w', buffering=1)
  File "/Users/nf/.virtualenvs/gmusic/lib/python2.7/codecs.py", line 884, in open
    file = __builtin__.open(filename, mode, buffering)
IOError: [Errno 2] No such file or directory: u'output/Late nights/early mornings.log'

The slash is a reserved character for directories, so the entire export fails. A reasonable workaround would be to swap slashes in names for dashes.

nickfishman avatar Dec 30 '15 20:12 nickfishman

thanks for reporting this and figuring out the root of the problem. I like the suggested fix, I'll update the code when I get a chance, or if someone else beats me to it I wouldn't be hurt ;)

soulfx avatar Dec 30 '15 23:12 soulfx