[Tutor] dumping .pck files
Patric Michael
patric at usa.net
Mon Jan 3 06:50:30 CET 2005
> I want to explore some mailman config files, e.g.
> config.pck. Some quick searches informed me that these
> contain pickled configuration info.
>
> My first naive attempt to dump what was in them failed:
>
> >>> import pickle
> >>> pickle.load(open("config.pck"))
> traceback....
> ImportError: No module named Mailman.Bouncer
>
> It seems that to do a good job of dumping the data, I need to tell it
> what this class looks like.
>
> Are there alternatives? Does the pickle format really not provide a
> way to inspect the data without the class definitions? E.g. if I
> didn't have the source code or didn't want to dig around in it?
>
> Is there a simple way to dump everything it does understand, and
> just print stubs for the parts it doesn't?
>
> Or is there some nice software to do this all for me?
>
> Or perhaps does mailman itself have handy command-line tools to aid in
> comparing configurations across mailing lists?
In the bin directory, find the script called "config_list". From the help file
(./config_list --help):
--outputfile filename
-o filename
Instead of configuring the list, print out a list's configuration
variables in a format suitable for input using this script. In this
way, you can easily capture the configuration settings for a
particular list and imprint those settings on another list. filename
is the file to output the settings to. If filename is `-', standard
out is used.
Dont forget to supply the list name in the command line.
For example:
config_list -o outfile.txt mylist
Patric
>
> Are there other serialization options that would make this easier?
>
> Many thanks,
>
> Neal McBurnett http://bcn.boulder.co.us/~neal/
> Signed and/or sealed mail encouraged. GPG/PGP Keyid: 2C9EBA60
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list