akolpakov / django-unused-media

Remove unused media files from Django project
MIT License
125 stars 25 forks source link

UnicodeDecodeError if a filename includes non-ascii characters #1

Closed trevoriancox closed 8 years ago

trevoriancox commented 8 years ago

The code seems to assume ascii file name characters, even though with Django media, the filenames typically originate with users who upload files.

This error is with Django 1.8, Python 2.7, and macOS.

The error is in stdout.write, but there may be other issues as the u'' convention is not used in filename-related code. (from future import unicode_literals might be a good idea).

File "python2.7/site-packages/django_unused_media/management/commands/cleanup_unused_media.py", line 43, in handle
    self.stdout.write(f)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcc in position 23: ordinal not in range(128)
akolpakov commented 8 years ago

Fixed in v1.5.0