Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44907

Re: Making safe file names

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'encoding': 0.05; 'subject:file': 0.07; 'currently,': 0.09; 'escape': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'api': 0.11; "wouldn't": 0.14; '(sorry,': 0.16; 'caches': 0.16; 'entities.': 0.16; 'naming': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'urlencode': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'artist': 0.24; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'andrew': 0.30; 'characters': 0.30; 'serve': 0.31; 'file': 0.32; 'run': 0.32; "i'd": 0.34; 'could': 0.34; 'something': 0.35; 'there': 0.35; 'really': 0.36; '(e.g.,': 0.36; 'scheme': 0.36; 'possible': 0.36; 'easily': 0.37; 'problems': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'pm,': 0.38; 'rather': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'most': 0.60; 'new': 0.61; 'received:173': 0.61; 'such': 0.63; 'forward': 0.65; 'special': 0.74; 'strategies': 0.77; 'conflicts': 0.84; 'received:fios.verizon.net': 0.84; 'subject:Making': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Jan Reedy <tjreedy@udel.edu>
Subject Re: Making safe file names
Date Tue, 07 May 2013 18:01:34 -0400
References <51895D03.4000300@gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-173-75-251-66.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5
In-Reply-To <51895D03.4000300@gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1420.1367964109.3114.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1367964109 news.xs4all.nl 15945 [2001:888:2000:d::a6]:55881
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44907

Show key headers only | View raw


On 5/7/2013 3:58 PM, Andrew Berg wrote:
> Currently, I keep Last.fm artist data caches to avoid unnecessary API calls and have been naming the files using the artist name. However,
> artist names can have characters that are not allowed in file names for most file systems (e.g., C/A/T has forward slashes). Are there any
> recommended strategies for naming such files while avoiding conflicts (I wouldn't want to run into problems for an artist named C-A-T or
> CAT, for example)? I'd like to make the files easily identifiable, and there really are no limits on what characters can be in an artist name.

Sounds like you want something like the html escape or urlencode 
functions, which serve the same purpose of encoding special chars. 
Rather than invent a new tranformation, you could use the same scheme 
used for html entities. (Sorry, I forget the details.) It is possible 
that one of the functions would work for you as is, or with little 
modification.

Terry


Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Making safe file names Terry Jan Reedy <tjreedy@udel.edu> - 2013-05-07 18:01 -0400

csiph-web