pkl2php is a script that reads in a python pickle file and spits out the
authorStephen Soltesz <soltesz@cs.princeton.edu>
Fri, 2 Nov 2007 16:34:28 +0000 (16:34 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Fri, 2 Nov 2007 16:34:28 +0000 (16:34 +0000)
equivalent as a php serialize file, for data sharing between python and php.

pkl2php.py [new file with mode: 0755]

diff --git a/pkl2php.py b/pkl2php.py
new file mode 100755 (executable)
index 0000000..9602525
--- /dev/null
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+
+import soltesz
+from config import config
+from optparse import OptionParser
+parser = OptionParser()
+parser.set_defaults(filename=None)
+parser.add_option("-f", "--dbname", dest="dbname", metavar="FILE", 
+                                       help="Provide the input file to convert")
+config = config(parser)
+config.parse_args()
+
+if config.dbname is None:
+       print "please provide a pickle file to convert"
+       import sys
+       sys.exit(1)
+
+data = soltesz.dbLoad(config.dbname)
+soltesz.dbDump(config.dbname, data, 'php')