Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="next" href="module-zlib.html" /> | |
13 | <link rel="prev" href="module-bsddb.html" /> | |
14 | <link rel="parent" href="someos.html" /> | |
15 | <link rel="next" href="dumbdbm-objects.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>7.14 dumbdbm -- Portable DBM implementation</title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="7.13.1 Hash, BTree and" | |
25 | href="bsddb-objects.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="7. Optional Operating System" | |
28 | href="someos.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="7.14.1 Dumbdbm Objects" | |
31 | href="dumbdbm-objects.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="bsddb-objects.html">7.13.1 Hash, BTree and</A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="someos.html">7. Optional Operating System</A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="dumbdbm-objects.html">7.14.1 Dumbdbm Objects</A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H1><A NAME="SECTION0091400000000000000000"> | |
56 | 7.14 <tt class="module">dumbdbm</tt> -- | |
57 | Portable DBM implementation</A> | |
58 | </H1> | |
59 | ||
60 | <P> | |
61 | <A NAME="module-dumbdbm"></A> | |
62 | ||
63 | <P> | |
64 | <a id='l2h-2812' xml:id='l2h-2812'></a> | |
65 | ||
66 | <P> | |
67 | <div class="note"><b class="label">Note:</b> | |
68 | The <tt class="module">dumbdbm</tt> module is intended as a last resort fallback for | |
69 | the <tt class="module"><a href="module-anydbm.html">anydbm</a></tt> module when no more robust module is available. | |
70 | The <tt class="module">dumbdbm</tt> module is not written for speed and is not nearly as | |
71 | heavily used as the other database modules. | |
72 | </div> | |
73 | ||
74 | <P> | |
75 | The <tt class="module">dumbdbm</tt> module provides a persistent dictionary-like interface | |
76 | which is written entirely in Python. Unlike other modules such as | |
77 | <tt class="module"><a href="module-gdbm.html">gdbm</a></tt> and <tt class="module"><a href="module-bsddb.html">bsddb</a></tt>, no external library is required. As | |
78 | with other persistent mappings, the keys and values must always be strings. | |
79 | ||
80 | <P> | |
81 | The module defines the following: | |
82 | ||
83 | <P> | |
84 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-2810' xml:id='l2h-2810' class="exception">error</tt></b></dt> | |
85 | <dd> | |
86 | Raised on dumbdbm-specific errors, such as I/O errors. <tt class="exception">KeyError</tt> | |
87 | is raised for general mapping errors like specifying an incorrect key. | |
88 | </dd></dl> | |
89 | ||
90 | <P> | |
91 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
92 | <td><nobr><b><tt id='l2h-2811' xml:id='l2h-2811' class="function">open</tt></b>(</nobr></td> | |
93 | <td><var>filename</var><big>[</big><var>, flag</var><big>[</big><var>, mode</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt> | |
94 | <dd> | |
95 | Open a dumbdbm database and return a dumbdbm object. The <var>filename</var> | |
96 | argument is the basename of the database file (without any specific | |
97 | extensions). When a dumbdbm database is created, files with <span class="file">.dat</span> and | |
98 | <span class="file">.dir</span> extensions are created. | |
99 | ||
100 | <P> | |
101 | The optional <var>flag</var> argument is currently ignored; the database is | |
102 | always opened for update, and will be created if it does not exist. | |
103 | ||
104 | <P> | |
105 | The optional <var>mode</var> argument is the <span class="Unix">Unix</span> mode of the file, used | |
106 | only when the database has to be created. It defaults to octal | |
107 | <code>0666</code> (and will be modified by the prevailing umask). | |
108 | ||
109 | <span class="versionnote">Changed in version 2.2: | |
110 | The <var>mode</var> argument was ignored in earlier | |
111 | versions.</span> | |
112 | ||
113 | </dl> | |
114 | ||
115 | <P> | |
116 | <div class="seealso"> | |
117 | <p class="heading">See Also:</p> | |
118 | ||
119 | <dl compact="compact" class="seemodule"> | |
120 | <dt>Module <b><tt class="module"><a href="module-anydbm.html">anydbm</a></tt>:</b> | |
121 | <dd>Generic interface to <code>dbm</code>-style databases. | |
122 | </dl> | |
123 | <dl compact="compact" class="seemodule"> | |
124 | <dt>Module <b><tt class="module"><a href="module-dbm.html">dbm</a></tt>:</b> | |
125 | <dd>Similar interface to the DBM/NDBM library. | |
126 | </dl> | |
127 | <dl compact="compact" class="seemodule"> | |
128 | <dt>Module <b><tt class="module"><a href="module-gdbm.html">gdbm</a></tt>:</b> | |
129 | <dd>Similar interface to the GNU GDBM library. | |
130 | </dl> | |
131 | <dl compact="compact" class="seemodule"> | |
132 | <dt>Module <b><tt class="module"><a href="module-shelve.html">shelve</a></tt>:</b> | |
133 | <dd>Persistence module which stores non-string data. | |
134 | </dl> | |
135 | <dl compact="compact" class="seemodule"> | |
136 | <dt>Module <b><tt class="module"><a href="module-whichdb.html">whichdb</a></tt>:</b> | |
137 | <dd>Utility module used to determine the type of an | |
138 | existing database. | |
139 | </dl> | |
140 | </div> | |
141 | ||
142 | <P> | |
143 | ||
144 | <p><br /></p><hr class='online-navigation' /> | |
145 | <div class='online-navigation'> | |
146 | <!--Table of Child-Links--> | |
147 | <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> | |
148 | ||
149 | <UL CLASS="ChildLinks"> | |
150 | <LI><A href="dumbdbm-objects.html">7.14.1 Dumbdbm Objects</a> | |
151 | </ul> | |
152 | <!--End of Table of Child-Links--> | |
153 | </div> | |
154 | ||
155 | <DIV CLASS="navigation"> | |
156 | <div class='online-navigation'> | |
157 | <p></p><hr /> | |
158 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
159 | <tr> | |
160 | <td class='online-navigation'><a rel="prev" title="7.13.1 Hash, BTree and" | |
161 | href="bsddb-objects.html"><img src='../icons/previous.png' | |
162 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
163 | <td class='online-navigation'><a rel="parent" title="7. Optional Operating System" | |
164 | href="someos.html"><img src='../icons/up.png' | |
165 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
166 | <td class='online-navigation'><a rel="next" title="7.14.1 Dumbdbm Objects" | |
167 | href="dumbdbm-objects.html"><img src='../icons/next.png' | |
168 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
169 | <td align="center" width="100%">Python Library Reference</td> | |
170 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
171 | href="contents.html"><img src='../icons/contents.png' | |
172 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
173 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
174 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
175 | <td class='online-navigation'><a rel="index" title="Index" | |
176 | href="genindex.html"><img src='../icons/index.png' | |
177 | border='0' height='32' alt='Index' width='32' /></A></td> | |
178 | </tr></table> | |
179 | <div class='online-navigation'> | |
180 | <b class="navlabel">Previous:</b> | |
181 | <a class="sectref" rel="prev" href="bsddb-objects.html">7.13.1 Hash, BTree and</A> | |
182 | <b class="navlabel">Up:</b> | |
183 | <a class="sectref" rel="parent" href="someos.html">7. Optional Operating System</A> | |
184 | <b class="navlabel">Next:</b> | |
185 | <a class="sectref" rel="next" href="dumbdbm-objects.html">7.14.1 Dumbdbm Objects</A> | |
186 | </div> | |
187 | </div> | |
188 | <hr /> | |
189 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
190 | </DIV> | |
191 | <!--End of Navigation Panel--> | |
192 | <ADDRESS> | |
193 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
194 | </ADDRESS> | |
195 | </BODY> | |
196 | </HTML> |