On Jul 30, 3:53 am, william tanksley <[EMAIL PROTECTED]> wrote: > To ask another way: how do I convert from a file:// URL to a local > path in a standard way, so that filepaths from two different sources > will work the same way in a dictionary? > > Right now I'm using the following source: > > track_id = url2pathname(urlparse(track_id).path) > > url2pathname is from urllib; urlparse is from the urlparse module. > > The problems occur when the filenames have non-ascii characters in > them -- I suspect that the URLs are having some encoding placed on > them that Python's decoder doesn't know about.
WHAT problems? WHAT non-ASCII characters?? Consider e.g. # track_id = url2pathname(urlparse(track_id).path) print repr(track_id) parse_result = urlparse(track_id).path print repr(parse_result) track_id_replacement = url2pathname(parse_result) print repr(track_id_replacement) and copy/paste the results into your next posting. -- http://mail.python.org/mailman/listinfo/python-list