Making safe file names

Andrew Berg bahamutzero8825 at gmail.com
Tue May 7 19:10:25 EDT 2013


On 2013.05.07 17:18, Fábio Santos wrote:
> I suggest Base64. b64encode
> (http://docs.python.org/2/library/base64.html#base64.b64encode) and
> b64decode take an argument which allows you to eliminate the pesky "/"
> character. It's reversible and simple.
> 
> More suggestions: how about a hash? Or just use IDs from the database?
None of these would work because I would have no idea which file stores data for which artist without writing code to figure it out. If I
were to end up writing a bug that messed up a few of my cache files and noticed it with a specific artist (e.g., doing a "now playing" and
seeing the wrong tags), I would either have to manually match up the hash or base64 encoding in order to delete just that file so that it
gets regenerated or nuke and regenerate my entire cache.

-- 
CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1



More information about the Python-list mailing list