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


Groups > comp.lang.python > #8335

Re: doing cross platform file work

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ryan@rfk.id.au>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'python.': 0.04; 'paths': 0.07; 'scripts': 0.09; 'content-type:multipart/signed': 0.09; 'filename:fname piece:signature': 0.09; 'url:packages': 0.09; 'api': 0.11; 'server,': 0.12; 'subject:file': 0.13; 'wed,': 0.13; 'wrote:': 0.15; 'library': 0.15; 'archive,': 0.16; 'content- type:application/pgp-signature': 0.16; 'filename:fname piece:asc': 0.16; 'filename:fname:signature.asc': 0.16; 'module:': 0.16; 'stdlib.': 0.16; 'cc:addr:python-list': 0.16; 'looked': 0.16; 'linux': 0.18; 'received:internal': 0.19; 'ryan': 0.19; 'cheers,': 0.19; 'cc:2**0': 0.21; 'linux,': 0.22; 'cc:no real name:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'received:10.202': 0.23; 'received:10.202.2': 0.23; 'received:66.111': 0.23; 'received:66.111.4': 0.23; 'received:messagingengine.com': 0.23; 'received:smtp.messagingengine.com': 0.23; 'modules': 0.25; 'remote': 0.28; "didn't": 0.29; 'cc:addr:python.org': 0.30; 'student': 0.30; 'kelly': 0.30; 'thanks': 0.30; '(including': 0.30; 'url:au': 0.31; 'there': 0.34; 'question': 0.35; 'url:python': 0.36; 'python.org': 0.36; 'disk': 0.37; 'platforms': 0.37; 'but': 0.37; 'some': 0.37; 'using': 0.38; 'received:192': 0.38; 'could': 0.38; 'url:org': 0.38; 'user': 0.38; 'subject:: ': 0.38; 'case,': 0.38; 'platform': 0.38; 'header:Mime-Version:1': 0.39; 'files,': 0.39; 'would': 0.40; 'more': 0.60; 'your': 0.61; 'details': 0.65; 'zip': 0.65; 'ever': 0.65; 'making': 0.66; 'memory,': 0.67; 'visit': 0.68; 'intend': 0.73; 'to:addr:yahoo.com': 0.83; '10:44': 0.84; 'url:fs': 0.84; 'immediately,': 0.91
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version; s=smtpout; bh=FiC1r2t2qK/Kir7CRRRZSoIjul0=; b=fpev2+gaac0rt7ztQnlswXDGFyNz0oXWWOQeqExHVWOdbZCHB7psr2NzFB7fcIh/tSXOVmbNrS/D2je3ofgiT3v5uswy5T5muS2R9Y0uPj5Q210UD8zoHOYpSYFO7F3BUegqreQ6bD9ir5lC3XKNm8vh8pHb/uUjN6fVxkp/lG0=
X-Sasl-enc F1J/PzxdcTM7nd3vo1W2MZGqNqZHIFVhHPkv36MJ25pP 1308869694
Subject Re: doing cross platform file work
From Ryan Kelly <ryan@rfk.id.au>
To Tim Hanson <tjhanson@yahoo.com>
In-Reply-To <201106221044.57169.tjhanson@yahoo.com>
References <201106221044.57169.tjhanson@yahoo.com>
Content-Type multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-5DxiPQhf9sl5UFFYOfkZ"
Date Fri, 24 Jun 2011 08:54:45 +1000
Mime-Version 1.0
X-Mailer Evolution 2.32.2
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.344.1308869703.1164.python-list@python.org> (permalink)
Lines 63
NNTP-Posting-Host 82.94.164.166
X-Trace 1308869704 news.xs4all.nl 14148 [::ffff:82.94.164.166]:36769
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:8335

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, 2011-06-22 at 10:44 -0700, Tim Hanson wrote:
> Thanks for your responses to my student question about using OS paths in 
> Python.
> 
> For the more general case, I am a Linux user interested in making my scripts 
> platform neutral, which would include Linux, Unix (including Mac), and 
> Windows.  I have looked at the python.org os segment and didn't get an answer.
> 
> Is there a library (bonus would be some tutorial material) for making sure my 
> Linux scripts access files and directories on the other platforms 
> transparently?  I don't need the information immediately, but at some point...

You could go all out and use the PyFilesystem module:

   http://packages.python.org/fs/


This provides a unified API not only for accessing files on your local
disk in a platform-agnostic manner, but also for accessing files in a
zip archive, on a remote server, in memory, and from a variety of other
sources.

Even if you only ever intend to access local files, I find the API
provided by PyFilesystem much nicer than using the various modules from
the stdlib.


  Cheers,

     Ryan


-- 
Ryan Kelly
http://www.rfk.id.au  |  This message is digitally signed. Please visit
ryan@rfk.id.au        |  http://www.rfk.id.au/ramblings/gpg/ for details

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


Thread

Re: doing cross platform file work Ryan Kelly <ryan@rfk.id.au> - 2011-06-24 08:54 +1000

csiph-web