From: Stephen Soltesz Date: Fri, 2 Nov 2007 16:34:28 +0000 (+0000) Subject: pkl2php is a script that reads in a python pickle file and spits out the X-Git-Tag: Monitor-1.0-0~59 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=582fe9dcdb6e7057e5e8e1f1aa729772fe25a321;p=monitor.git pkl2php is a script that reads in a python pickle file and spits out the equivalent as a php serialize file, for data sharing between python and php. --- diff --git a/pkl2php.py b/pkl2php.py new file mode 100755 index 0000000..9602525 --- /dev/null +++ b/pkl2php.py @@ -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')