File: DATABASE

package info (click to toggle)
mma 21.09-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 51,828 kB
  • sloc: python: 16,751; sh: 26; makefile: 18; perl: 12
file content (26 lines) | stat: -rw-r--r-- 788 bytes parent folder | download | duplicates (2)
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

MMA maintains database files in each lib directory. These are simple
 files consisting of a single dictionary which is saved to disk using
 the pickle module.

You can read this file with a simple python program:

   #!/usr/bin/python
   import pickle

   infile = ".mmaDB"
   f = open(infile, "r")  # you have to be in the lib directory
   f.readline()           # Read/discard comment line
   g = pickle.load(f)
   f.close()
   print(g)

We seriously considered switching to a json format, but several other
 programs rely on this behavior so we'll leave well enough alone. 

We use pickle protocol 2 for saving data. Don't use 3 or HIGHEST_PROTOCOL!
 This results in database files which are not compatible been py2 and p3.
 (And don't ask how I figured this out!)

bvdp, 2019/03/09