Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'source.': 0.05; 'transform': 0.05; 'api': 0.09; 'python': 0.09; '22,': 0.09; 'python:': 0.09; 'cc:addr:python-list': 0.10; 'commit': 0.15; 'dec': 0.15; 'sat,': 0.15; 'slightly': 0.15; '12:57': 0.16; '`path`': 0.16; 'anymore': 0.16; 'belongs': 0.16; 'folks,': 0.16; 'nevertheless': 0.16; 'skip:g 50': 0.16; 'url:gnome': 0.16; 'url:urllib': 0.16; 'wrote:': 0.17; 'module': 0.19; 'written': 0.20; 'assuming': 0.22; 'latter': 0.22; 'defined': 0.22; 'cc:2**0': 0.23; '(you': 0.23; 'header': 0.24; 'specifically': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'skip:" 20': 0.26; 'am,': 0.27; 'checking': 0.27; 'realize': 0.27; 'topic': 0.27; 'is?': 0.27; 'message-id:@mail.gmail.com': 0.27; 'chris': 0.28; 'chase': 0.29; 'implied': 0.29; 'source': 0.29; 'probably': 0.29; 'maybe': 0.29; 'related': 0.30; 'daniel': 0.30; 'function': 0.30; 'stuff': 0.30; 'url:python': 0.32; 'could': 0.32; 'docs': 0.33; 'turns': 0.33; 'anyone': 0.33; 'likely': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'done': 0.34; 'list': 0.35; 'exist': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'url:org': 0.36; 'skip:g 30': 0.36; 'totally': 0.36; 'url:library': 0.36; 'enough': 0.36; 'does': 0.37; 'uses': 0.37; 'being': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'things': 0.38; 'url:docs': 0.38; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'url:mail': 0.40; 'skip:u 10': 0.60; 'more': 0.63; 'hoping': 0.72; 'merry': 0.84; 'presumably': 0.84; 'sender:addr:chris': 0.84; 'lift': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=FntPQjjl449y7YmKkgTKPdcXaXT+AfQPWi9kjt8PSDM=; b=NtsJWfanlQfE62V1vK913VmRmJlmcmveUvDdD5HLGPBRhrEgX4b7vPLSoFsPSsh+wQ YIP1h8CxQywFXOPTiJKLsXYfJjoo5QeTReGLrMOXieiQrmzh+Fn+kEgu3wLdNr1nf5k+ QF/K8qpywCxFuVsmyuD9xNzByCpVqz+i7Dtpk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=FntPQjjl449y7YmKkgTKPdcXaXT+AfQPWi9kjt8PSDM=; b=g2q3kYJkG9JjVQ7AOU33j1RkqT8r2qMlyYhELJ0f6sIGZhzQLOtNT0tjBRJ9tRERYh g+OR7cDXqKTH65KD9MxH9KJYlaneLMJ5P2oslzqpzsYAS0KXJf0+UgZCnlmIVjCuH9mc 8nm/txD7Pf0qN6Mh5c2Rm318DSTMvgFF5GYAHqQNr/c2OC4DdAqBAettLXEhxeeiwy52 bhiiioFC1NRX5Tj8fxn8vhjv6TrRYHMsVsfsDRTIvB/LCmLoqUi/yQYSHpR7R1LOUd30 phJWDgDK34CxcBFVDOxnrFQP1JnKIxvvGeXe2xv0VG+EnYr06JCa+bvmlQJi3nVR4JWy tM8g== MIME-Version: 1.0 Sender: chris@rebertia.com In-Reply-To: References: Date: Sat, 22 Dec 2012 01:34:36 -0800 X-Google-Sender-Auth: 3xL_H0k4RpqWNyCNgXErGnN33Ao Subject: Re: pygnomevfs get_local_path_from_uri replacement From: Chris Rebert To: Daniel Fetchinson Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQmuyOgwy2tMxkZAPBjZNYkx4oZy/1YaoAjDfoKhgll2e3CdoNFoxKHfgAybo8Ca8Ejssms+ Cc: Python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1356168885 news.xs4all.nl 6977 [2001:888:2000:d::a6]:49924 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35351 On Sat, Dec 22, 2012 at 12:57 AM, Daniel Fetchinson wrote: > Hi folks, I realize this is slightly off topic and maybe belongs to a > gnome email list but it's nevertheless python: > > I use an old python program that was written for gnome 2 and gtk 2 and > uses the function get_local_path_from_uri. More specifically it uses > gnomevfs.get_local_path_from_uri. > > Now with gnome 3 the module pygnomevfs does not exist anymore and > after checking the source for pygnomevfs it turns out it's written in > C using all the header files and stuff from gnome 2. So I can't just > lift it from the source. I was hoping it's pure python in which case I > could have simply lifted it. > > Does anyone know what a good replacement for get_local_path_from_uri > is? Is there a gtk/gnome/etc related python package that contains it > which would work with gnome 3? Or a totally gnome-independent python > implementation? The commit https://mail.gnome.org/archives/commits-list/2009-May/msg05733.html suggests that get_local_path_from_uri() might have been defined as (taking slight liberties): gnome_vfs_unescape_string(remove_host_from_uri(uri)) Assuming these functions do the "obvious" things implied by their names (you can probably chase down the Gnome VFS source or docs to check; I don't care enough to bother), given a general URI "protocol://host/path", it presumably returns either "protocol:///path" (`protocol:` likely being "file:" in this case) or "/path", in either case with `path` having been un-percent-escaped. The latter transform can be done using http://docs.python.org/2/library/urllib.html#urllib.unquote Alternately, you might call the Gnome VFS C API directly via http://docs.python.org/2/library/ctypes.html Merry Solstice, Chris