File: README.md

package info (click to toggle)
python-biplist 1.0.3-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 376 kB
  • sloc: python: 1,419; makefile: 3
file content (62 lines) | stat: -rw-r--r-- 1,558 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
biplist
=======
`biplist` is a binary plist parser/generator for Python.

## About

Binary Property List (plist) files provide a faster and smaller serialization
format for property lists on OS X. This is a library for generating binary
plists which can be read by OS X, iOS, or other clients.

## API

The API models the `plistlib` API, and will call through to plistlib when
XML serialization or deserialization is required.

To generate plists with UID values, wrap the values with the `Uid` object. The
value must be an int.

To generate plists with `NSData`/`CFData` values, wrap the values with the
`Data` object. The value must be a string.

Date values can only be `datetime.datetime` objects.

The exceptions `InvalidPlistException` and `NotBinaryPlistException` may be 
thrown to indicate that the data cannot be serialized or deserialized as
a binary plist.

## Installation

To install the latest release version:

`sudo easy_install biplist`

## Examples

Plist generation example:

```python
from biplist import *
from datetime import datetime
plist = {'aKey':'aValue',
         '0':1.322,
         'now':datetime.now(),
         'list':[1,2,3],
         'tuple':('a','b','c')
         }
try:
    writePlist(plist, "example.plist")
except (InvalidPlistException, NotBinaryPlistException), e:
    print "Something bad happened:", e
```

Plist parsing example:

```python
from biplist import *
try:
    plist = readPlist("example.plist")
    print plist
except (InvalidPlistException, NotBinaryPlistException), e:
    print "Not a plist:", e
```