| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 1 | :mod:`whichdb` --- Guess which DBM module created a database | 
 | 2 | ============================================================ | 
 | 3 |  | 
 | 4 | .. module:: whichdb | 
 | 5 |    :synopsis: Guess which DBM-style module created a given database. | 
 | 6 |  | 
| Georg Brandl | 68d3eb9 | 2008-05-26 10:22:15 +0000 | [diff] [blame] | 7 | .. note:: | 
 | 8 |    The :mod:`whichdb` module's only function has been put into the :mod:`dbm` | 
 | 9 |    module in Python 3.0.  The :term:`2to3` tool will automatically adapt imports | 
 | 10 |    when converting your sources to 3.0. | 
 | 11 |  | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 12 |  | 
 | 13 | The single function in this module attempts to guess which of the several simple | 
 | 14 | database modules available--\ :mod:`dbm`, :mod:`gdbm`, or :mod:`dbhash`\ | 
 | 15 | --should be used to open a given file. | 
 | 16 |  | 
 | 17 |  | 
 | 18 | .. function:: whichdb(filename) | 
 | 19 |  | 
 | 20 |    Returns one of the following values: ``None`` if the file can't be opened | 
 | 21 |    because it's unreadable or doesn't exist; the empty string (``''``) if the | 
 | 22 |    file's format can't be guessed; or a string containing the required module name, | 
 | 23 |    such as ``'dbm'`` or ``'gdbm'``. | 
 | 24 |  |