Bob Ippolito (@etrepum) on Haskell, Python, Erlang, JavaScript, etc.

xattr - Python extended filesystem attributes


xattr is a Python wrapper for the extended attributes APIs available in Darwin 8.0+ (Mac OS X 10.4) and Linux 2.6+. 0.2 added Linux compatibility, and API compatibility with the GPL pyxattr module. Unlike pyxattr, xattr supports both Darwin and Linux, has a dict-like API, and it is MIT licensed.

Usage looks like this:

>>> import xattr
>>> x = xattr.xattr('tiger_8a428_userdvd.dmg')
>>> x
<xattr file='tiger_8a428_userdvd.dmg'>
>>> x.keys()
>>> dict(x)
{u'': 'i:969254 ...more stuff'}
>>> x['']
'i:969254 ...more stuff'
>>> x[''] = 'select'
>>> dict(x)
{u'': 'select',
 u'': 'i:969254 ...more stuff'}
>>> del x['']
>>> dict(x)
{u'': 'i:969254 ...more stuff'}

You can download xattr 0.2 from for Tiger's Python 2.3.5 or Python 2.4.1 (installed on Tiger).

svn trunk:
0.2 source:
blog comments powered by Disqus